LB Booster
Programming >> BASIC code examples >> Undrawing a circle
http://lbb.conforums.com/index.cgi?board=code&action=display&num=1429392942

Undrawing a circle
Post by Richard Russell on Apr 18th, 2015, 9:35pm

LBB does not have graphics segments, but the flush and redraw commands can still be put to good use. For example in this program (adapted from one posted to the LB forum by Anatoly) they are used in combination to 'undraw' a graphics object:

Code:
nomainwin

open "click to clear circle" for graphics_nsb_nf as #gr
#gr "trapclose [quit]"
#gr "down"

'draw some stuff
randomize .5
for i =1 to 10
    x=rnd(1)*200
    y=rnd(1)*200
    #gr "place ";x;" "; y
    #gr "box ";x+rnd(1)*100;" "; y+rnd(1)*100
next

'copy graphics
#gr "flush"
'draw circle
#gr "place 150 150; circle 100"

'set event handler
#gr "when leftButtonDown [clear1]"
wait

[clear1]
'restore graphics
#gr "redraw"

'set event handler off
#gr "when leftButtonDown"
wait

[quit]
close #gr
end 

Richard.