Clearing out rectangles

Karen Karen at curlypaws.com
Fri Dec 30 21:05:41 EST 2005


> On 2005-12-31 01:50:09 +0000, Sarah Reichelt <sarah.reichelt- 
> Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> said:
>
>> I'm trying to draw a bar graph in Revolution using values from an
>> array.  I use the following code, repeated for each bar, to draw the
>> graph:
>>
>> create invisible graphic
>> set the style of it to rectangle
>> set the opaque of it to true
>> set the rectangle of it to startY,tDrawX,tDrawY,startX
>> set the foregroundColor of it to "#000000"
>> set the backgroundColor of it to "#9198A0"
>> set the lineSize of it to 1
>> show it
>>
>> This all works very well, but the next time I come to draw the graph,
>> the old rectangles are still sitting there.  How can I get rid of  
>> them?
>
>
> Have a loop at the start of your drawing routine that goes through and
> deletes them all. If you have no other graphics, you can do:
>
>    repeat the number of graphics times
>         delete graphic 1
>     end repeat
>
> If you have other graphics that shouldn't be deleted, then I suggest
> you name your chart graphics as they are made, and do something like
> this:
>
>     repeat with x = the number of graphics down to 1
>         if the short name of graphic x contains "Chart" then delete  
> graphic  x
>     end repeat
>
> HTH,
> Sarah

Thanks very much for the very prompt reply Sarah :-) - I do have some  
other graphics so I'll need to go the second route.

Thanks again,

Karen



More information about the use-livecode mailing list