UseGadgetList()

Syntax

Result = UseGadgetList(WindowID)
Description
Select the GadgetList window to which gadgets will be added. If there is no GadgetList on this window so far it will be created. (because it was created with the #PB_Window_NoGadgets flag in OpenWindow() or because it is not a PB window)

Parameters

WindowID The new window to add gadgets to. It can be obtained with the WindowID() function. If 'WindowID' is 0, the current GadgetList window will be returned and nothing will be changed.

Return value

Returns the WindowID of the previous GadgetList window, or 0 if there was none. This value can be used to go back to the previous GadgetList later.

Example

This example shows how to use this command to create a new window with gadgets without interrupting the gadget creation on the current window:
  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
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

See Also

OpenWindow(), WindowID()

Supported OS

All

<- UnbindGadgetEvent() - Gadget Index - WebGadget() ->