Posted: Sun Sep 15, 2002 1:03 am
Restored from previous forum. Originally posted by Jose.
;
; Adapted sample Window.pb in samples, to demonstrate the problem
;
#G_EXIT = 1
lwMainWin = OpenWindow(0, 100, 100, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
Debug WindowID()
Debug lwMainWin ; produce same result as WindowID()
Debug WindowID(#G_EXIT) ; returns 0=#G_EXIT
If lwMainWin 0
If CreateGadgetList(WindowID())
ButtonGadget(#G_EXIT,50,50,73,25,"Exit")
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_EventGadget
Select EventGadgetID()
Case #G_EXIT ; Exit button Clickd
; If Debugger is off, program crashes
CloseWindow(lwMainWin) ; <--- Causes Debugger error message
; Window object number is very High (Over 5000) are you Sure?
; No options available in debug window, only QUIT available.
; CloseWindow(WindowID()) ; <--- Causes Same Error
; CloseWindow(#G_EXIT) ; Works
; CloseWindow(WindowID(#G_EXIT)) ; Works
EndSelect
EndIf
Until EventID = #PB_EventCloseWindow
EndIf
MessageRequester("Debugging", "Finished" , 0)
End
; OPenWindow() should return WindowID(#G_EXIT) instead of WindowID()
; or internal windows handle, there must be a reason for this behavior.
; Can some one explain?
; Would be nice in the documentation to distinguish between these two values,
; and also to explain their use in PB.
Thanks
;
; Adapted sample Window.pb in samples, to demonstrate the problem
;
#G_EXIT = 1
lwMainWin = OpenWindow(0, 100, 100, 195, 260, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget, "PureBasic Window")
Debug WindowID()
Debug lwMainWin ; produce same result as WindowID()
Debug WindowID(#G_EXIT) ; returns 0=#G_EXIT
If lwMainWin 0
If CreateGadgetList(WindowID())
ButtonGadget(#G_EXIT,50,50,73,25,"Exit")
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_EventGadget
Select EventGadgetID()
Case #G_EXIT ; Exit button Clickd
; If Debugger is off, program crashes
CloseWindow(lwMainWin) ; <--- Causes Debugger error message
; Window object number is very High (Over 5000) are you Sure?
; No options available in debug window, only QUIT available.
; CloseWindow(WindowID()) ; <--- Causes Same Error
; CloseWindow(#G_EXIT) ; Works
; CloseWindow(WindowID(#G_EXIT)) ; Works
EndSelect
EndIf
Until EventID = #PB_EventCloseWindow
EndIf
MessageRequester("Debugging", "Finished" , 0)
End
; OPenWindow() should return WindowID(#G_EXIT) instead of WindowID()
; or internal windows handle, there must be a reason for this behavior.
; Can some one explain?
; Would be nice in the documentation to distinguish between these two values,
; and also to explain their use in PB.
Thanks