Page 1 of 1

PB 5.60b1

Posted: Fri Jan 27, 2017 4:41 pm
by DoubleDutch
The UseGadgetList command doesn't work as it used to, gadgets created in it no longer generate events...

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
In this example you will see that the button with id '10' will not create an event.

Re: PB 5.60b1

Posted: Fri Jan 27, 2017 4:43 pm
by Fred
You need to use UseGadgetList(WindowID(0, #PB_Window_GadgetList)) from now on, because we added new gadget container (they are not directly added to the window)

Re: PB 5.60b1

Posted: Fri Jan 27, 2017 4:58 pm
by DoubleDutch
Ahh - Thanks for the help, everything else seems great so far. :)

(The example will need to be updated in the help system)

WindowID = WindowID(#Window) also doesn't mention this extra parameter yet.

Re: PB 5.60b1

Posted: Thu Feb 02, 2017 10:37 pm
by JHPJHP
Hi Fred,
Fred wrote:You need to use UseGadgetList(WindowID(0, #PB_Window_GadgetList)) from now on, because we added new gadget container (they are not directly added to the window)
I'm getting Constant not found: #PB_Window_GadgetList with the new PureBasic 5.60 Beta 2 build.

Thank you.

Re: PB 5.60b1

Posted: Thu Feb 02, 2017 10:46 pm
by DoubleDutch
yes, it's reverted back. Take it out and things will work as they did before.

Re: PB 5.60b1

Posted: Thu Feb 02, 2017 10:53 pm
by JHPJHP
Hi DoubleDutch,

Thank you for the response.

Did you read somewhere that this was permanent? I did a cursory search, but didn't find anything; otherwise I'll wait for the next release for it to be corrected.

Re: PB 5.60b1

Posted: Fri Feb 03, 2017 8:41 am
by Fred
It is permanent, sorry for the trouble.