CheckBoxGadget()

Syntax

Result = CheckBoxGadget(#Gadget, x, y, Width, Height, Text$ [, Flags])
Description
Create a checkbox gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget identifier will be returned as 'Result'. #Gadget will be the number returned by EventGadgetID() command. The 'Text$' is a description of the checkbox which will be displayed to the right of it.

You can add a 'mini help' to this gadget by using GadgetToolTip().

- GetGadgetState() can be used to get the current gadget state (checked or unchecked).
- SetGadgetState() can be used to change the gadget state (checked or unchecked).

'Flags' are always optional and can be composed of one of the following constants:
  #PB_CheckBox_Right  : Aligns the text to right
  #PB_CheckBox_Center : Centers the text
Example:
  If OpenWindow(0,0,0,270,130,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"CheckBoxGadget") And CreateGadgetList(WindowID(0))
    CheckBoxGadget(0,10, 10,250,20,"CheckBox standard")
    CheckBoxGadget(1,10, 40,250,20,"CheckBox checked") : SetGadgetState(1,1)
    CheckBoxGadget(2,10, 70,250,20,"CheckBox right", #PB_CheckBox_Right)
    CheckBoxGadget(3,10,100,250,20,"CheckBox center", #PB_CheckBox_Center)
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndIf

Supported OS

All

<- ChangeListIconGadgetDisplay() - Gadget Index - ClearGadgetItemList() ->