From: Steve Tuckner Date: 2003-01-28T07:28:34+09:00 Subject: [FXRuby] How to force a paint on a canvas. This is a multi-part message in MIME format. ------=_NextPart_000_01FA_01C2C621.1E1861D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello all, I am working on a simple turtle graphics demonstration program that I can use to give a demonstration to several classes of 1st graders. The problem I am having is that I can draw on the canvas widget, but I can't force it repaint after I draw. The canvas code looks like below: @outputCanvas.connect(SEL_PAINT) do |sender, sel, event| dc = FXDCWindow.new(@outputCanvas) dc.background = FXColor::White dc.foreground = FXColor::White dc.fillRectangle(event.rect.x, event.rect.y, event.rect.w, event.rect.h) dc.foreground = FXColor::Red @actions.each do |action| action.do(dc) end # dc.fillRectangle(0,0,@x,@y) # @x += 10; @y += 10 dc.end end on a paint it iterates through a list of actions which do lines and turns (for now). It works fine except that I have to cover and uncover the window to see the results. I tried FXWindow#repaint and FXApplication#repaint to no avail. Any ideas? Thanks, Steve Tuckner ------=_NextPart_000_01FA_01C2C621.1E1861D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello = all,
 
I am = working on a=20 simple turtle graphics demonstration program that I can use to give a=20 demonstration to several classes of 1st graders. The problem I am = having is that=20 I can draw on the canvas widget, but I can't force it repaint after I = draw. The=20 canvas code looks like below:
 
@outputCanvas.connect(SEL_PAINT) do |sender, sel,=20 event|
    dc =3D=20 FXDCWindow.new(@outputCanvas)
    dc.background =3D=20 FXColor::White
    dc.foreground =3D=20 FXColor::White
    dc.fillRectangle(event.rect.x,=20 event.rect.y, event.rect.w, event.rect.h)
    = dc.foreground =3D=20 FXColor::Red
    @actions.each do=20 |action|
    =   action.do(dc)
   =20 end
#    = dc.fillRectangle(0,0,@x,@y)
#    @x=20 +=3D 10; @y +=3D 10
    = dc.end
end
on a = paint it=20 iterates through a list of actions which do lines and turns (for now). = It works=20 fine except that I have to cover and uncover the window to see the=20 results.
 
I = tried=20 FXWindow#repaint and FXApplication#repaint to no = avail.
 
Any=20 ideas?
 
Thanks,
 
Steve = Tuckner
 
------=_NextPart_000_01FA_01C2C621.1E1861D0--