Strange DrawRect behaviour

For some reason for me "DrawRect" behaves odd when used in a function:
It seems only the first call of drawrect will be done and all others ignored.

For example
setdrawlayer /W=main Userfront
SetDrawEnv /W=main xcoord=bottom, ycoord=left
for (i=0;i<11;i+=1)
   drawrect /W=main (100*i-10),0,(100*i+10),10
endfor

will only result in a single rectangle drawn.
This happens in userfront as well as in userback.
Any idea why this is happening and how to circumvent it?

I noticed some similar oddities with drawtext, too....
Well, some additional info:
I thought that maybe i overlooked something and saved the graph macro for the created graph.
In there, all drawrect commands were also present. But for some reason not drawn (even after recreating the graph from the macro)
All you need is to add to your SetDrawEnv command a "save" keyword as in:

SetDrawEnv /W=main xcoord=bottom, ycoord=left, save

Otherwise you could put this call inside your loop but that would be wasteful.

HTH,

AG
Hello,

I encountered a similar issue because of the fact that the graph/image was embedded into a panel.
Therefore, one has to explicitely specifiy the target subwindow using the SetActiveSubWindow instruction.

Best Regards