Page 1 of 1
Drawing on a Window is overwritten
Posted: Fri Jan 25, 2013 10:46 am
by Niffo
OpenWindow(0, 100, 100, 300, 200, "Test")
StartDrawing(WindowOutput(0))
Box(50, 50, 50, 50, 0)
StopDrawing()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: [5.10b5] Drawing on a Window is overwritten
Posted: Fri Jan 25, 2013 2:59 pm
by Fred
You need to handle the #PB_Window_Repaint event, you can't known when the OS will ask for refresh.
Re: Drawing on a Window is overwritten
Posted: Fri Jan 25, 2013 3:09 pm
by ts-soft
example:
Code: Select all
OpenWindow(0, 100, 100, 300, 200, "Test")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Repaint
StartDrawing(WindowOutput(0))
Box(50, 50, 50, 50, 0)
StopDrawing()
EndSelect
ForEver
Re: Drawing on a Window is overwritten
Posted: Sun Jan 27, 2013 3:49 am
by WilliamL
I make the drawing part of the window a procedure then just call it when I first show the window and then when the repaint event happens. If the repaint event is called by opening the window then you will only have to call the drawing procedure by the event.
I had a posting about this somewhere but I can't find it now...