CreateGadgetList()

Syntax

Result = CreateGadgetList(WindowID)
Description
Allocate the resources for a future GadgetList. This command must be called before any gadget creation command like ButtonGadget(), etc. The 'WindowID' parameter can be easily obtained using WindowID() from the Window library.

Note: There is no separate administration of the gadget lists for every opened window in PureBasic. Therefore you should use ongoingly numbered 'GadgetID's also for several windows. Or use the new #PB_Any constant as 'GadgetID'.

Example:
  ; Define your window first...
  If OpenWindow(0, 0, 0, 250, 105, "Create gadgets...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ; Now create the gadget-list...
    If CreateGadgetList(WindowID(0))   ; the gadget-list was sucessfully created
      ; define your gadgets here...
      ButtonGadget(0, 10, 15, 230, 30, "Test button")
    Else                               ; the gadget-list couldn't be created
      ; show an error message here, end the program etc...
    EndIf  
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- CountGadgetItems() - Gadget Index - DateGadget() ->