OptionGadget()

Syntax

Result = OptionGadget(#Gadget, x, y, Width, Height, Text$)
Description
Creates an OptionGadget in the current GadgetList.

Parameters

#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.
Text$ The text to display.

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.

Remarks

The first time this function is called, a group is created and all following calls of OptionGadget() will add a gadget to this group. To finish the group, just create a gadget of another type. These kind of gadgets are very useful as only one gadget from the group can be selected at any time.

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

Example

  If OpenWindow(0, 0, 0, 140, 110, "OptionGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    OptionGadget(0, 30, 20, 100, 20, "Option 1")
    OptionGadget(1, 30, 45, 100, 20, "Option 2")
    OptionGadget(2, 30, 70, 100, 20, "Option 3")
    SetGadgetState(1, 1)   ; set second option as active one
  EndIf

See Also

GetGadgetText(), SetGadgetText(), GetGadgetState(), SetGadgetState(), CheckBoxGadget()
<- OpenGadgetList() - Gadget Index - PanelGadget() ->