PB 5.60b1
Posted: Fri Jan 27, 2017 4:41 pm
The UseGadgetList command doesn't work as it used to, gadgets created in it no longer generate events...
In this example you will see that the button with id '10' will not create an event.
Code: Select all
If OpenWindow(0, 0, 0, 500, 500, "Main Window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 150, 25, "Button 1")
; Create Window with #PB_Window_NoGadgets to prevent automatic GadgetList creation
If OpenWindow(1, 0, 0, 300, 200, "Child Window", #PB_Window_TitleBar | #PB_Window_WindowCentered | #PB_Window_NoGadgets, WindowID(0))
OldGadgetList = UseGadgetList(WindowID(1)) ; Create GadgetList and store old GadgetList
ButtonGadget(10, 10, 10, 150, 25, "Child Window Button")
UseGadgetList(OldGadgetList) ; Return to previous GadgetList
EndIf
ButtonGadget(1, 10, 45, 150, 25, "Button 2") ; This will be on the main window again
Repeat
event=WaitWindowEvent()
If event=#PB_Event_Gadget
gadget=EventGadget()
Debug(gadget)
EndIf
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf