StartDrawing(WindowOutput(0))=null
Posted: Mon Aug 04, 2008 11:05 pm
I am experimenting with the Demo PB (4.20) and when I use this code (example from manual) I get 'result is a null=0 value' and the program locks up. How do I get this to work?
If OpenWindow(0, 100, 100, 300, 400, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
If StartDrawing(WindowOutput(0))
Box(10,10,20,20)
Line(30,50,100,100)
StopDrawing()
EndIf
;
; This is the 'event loop'. All the user actions are processed here.
; It's very easy to understand: when an action occurs, the EventID
; isn't 0 and we just have to see what have happened...
;
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button
Quit = 1
EndIf
Until Quit = 1
EndIf
End ; All the opened windows are closed automatically by PureBasic
PB looks like what I'm looking for, especially if it will run natively on an Intel Mac.
Thanks - William
If OpenWindow(0, 100, 100, 300, 400, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
If StartDrawing(WindowOutput(0))
Box(10,10,20,20)
Line(30,50,100,100)
StopDrawing()
EndIf
;
; This is the 'event loop'. All the user actions are processed here.
; It's very easy to understand: when an action occurs, the EventID
; isn't 0 and we just have to see what have happened...
;
Repeat
EventID.l = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow ; If the user has pressed on the close button
Quit = 1
EndIf
Until Quit = 1
EndIf
End ; All the opened windows are closed automatically by PureBasic
PB looks like what I'm looking for, especially if it will run natively on an Intel Mac.
Thanks - William