I have an app using BindEvent to handle all its events, and it also has multiple child windows that pop out next to the main window. When I close a child window I should be returned to the main window, the app shouldn't exit. Here's a tiny example:
Code: Select all
EnableExplicit
Enumeration Windows
#Window_Main
#Window_Popup
EndEnumeration
Enumeration Gadgets
#Gadget_PopupButton
#Gadget_CloseButton
EndEnumeration
Procedure PopupWindowEvents()
Select EventGadget()
Case #Gadget_CloseButton
CloseWindow(#Window_Popup)
EndSelect
EndProcedure
Procedure CreatePopupWindow()
OpenWindow(#Window_Popup, #PB_Ignore, #PB_Ignore, 600, 400, "Subwindow")
ButtonGadget(#Gadget_CloseButton, 10, 10, 50, 50, "Close")
BindEvent(#PB_Event_Gadget, @PopupWindowEvents())
SetActiveGadget(#Gadget_CloseButton)
EndProcedure
Procedure MainWindowEvents()
Select EventGadget()
Case #Gadget_PopupButton
CreatePopupWindow()
EndSelect
EndProcedure
Procedure MainWindowCloseHandler()
End
EndProcedure
OpenWindow(#Window_Main, #PB_Ignore, #PB_Ignore, 600, 400, "Test")
ButtonGadget(#Gadget_PopupButton, 10, 10, 50, 50, "Show popup")
BindEvent(#PB_Event_Gadget, @MainWindowEvents())
BindEvent(#PB_Event_CloseWindow, @MainWindowCloseHandler())
SetActiveGadget(#Gadget_PopupButton)
Repeat
Define Event = WaitWindowEvent(1)
ForEver
What am I missing?
Thanks!



