Result = ContainerGadget(#Gadget, x, y, Width, Height [, Flags])
Creates a container gadget in the current GadgetList. It's a simple panel gadget which can contain other gadgets.


#Gadget A number to identify the new gadget. #PB_Any can be used to auto-generate this number.
x, y, Width, Height The position and dimensions of the new gadget.
Flags (optional) Flags to modify the gadget behavior. It can be composed of one of the following constants:
  #PB_Container_BorderLess : Without any border (Default).
  #PB_Container_Flat       : Flat frame.
  #PB_Container_Raised     : Raised frame.
  #PB_Container_Single     : Single sunken frame.
  #PB_Container_Double     : Double sunken frame.

Return value

Returns nonzero on success and zero on failure. If #PB_Any was used as the #Gadget parameter then the return-value is the auto-generated gadget number on success.


Once the gadget is created, all future created gadgets will be created inside the container. When all the needed gadgets have been created, CloseGadgetList() must be called to return to the previous GadgetList. OpenGadgetList() can be used later to add others gadgets on the fly in the container area.

The following event is supported through EventType():
  #PB_EventType_Resize: The gadget has been resized.

A 'mini help' can be added to this gadget using GadgetToolTip().

This gadget supports the SetGadgetColor() and GetGadgetColor() functions with #PB_Gadget_BackColor as type to change the gadget background.


  If OpenWindow(0, 0, 0, 322, 150, "ContainerGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ContainerGadget(0, 8, 8, 306, 133, #PB_Container_Raised)
      ButtonGadget(1, 10, 15, 80, 24, "Button 1")
      ButtonGadget(2, 95, 15, 80, 24, "Button 2")

See Also

OpenGadgetList(), CloseGadgetList(), SetGadgetColor(), GetGadgetColor()

Supported OS


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