OpenWindow(0, 100, 100, 300, 200, "Test")
StartDrawing(WindowOutput(0))
Box(50, 50, 50, 50, 0)
StopDrawing()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Drawing on a Window is overwritten
Re: [5.10b5] Drawing on a Window is overwritten
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
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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: Drawing on a Window is overwritten
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...
I had a posting about this somewhere but I can't find it now...
MacBook Pro-M1 (2021), Sequoia 15.4, PB 6.20