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 number will be returned as 'Result'. #Gadget will be the number returned by EventGadget() function. 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.
- SetGadgetState() can be used to change the gadget state.
'Flags' are always optional and can be one of the following constants:#PB_CheckBox_Right : Aligns the text to right (Windows only). #PB_CheckBox_Center : Centers the text (Windows only). #PB_CheckBox_ThreeState: Create a checkbox that can have a third "inbetween" state.The #PB_CheckBox_ThreeState flag can be used for a checkbox that represents the state of multiple items. The "inbetween" state can then be used to indicate that the setting is not the same for all items. By clicking on the checkbox, the user can bring it back to either the "on" or "off" state to apply this to all the items. Therefore the "inbetween" state can only be set by the program via SetGadgetState() and not by the user by clicking on the checkbox.Example:
If OpenWindow(0, 0, 0, 270, 160, "CheckBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) CheckBoxGadget(0, 10, 10, 250, 20, "CheckBox standard") CheckBoxGadget(1, 10, 40, 250, 20, "CheckBox checked"): SetGadgetState(1, #PB_Checkbox_Checked) CheckBoxGadget(2, 10, 70, 250, 20, "CheckBox three state", #PB_CheckBox_ThreeState): SetGadgetState(2, #PB_Checkbox_Inbetween) CheckBoxGadget(3, 10, 100, 250, 20, "CheckBox right", #PB_CheckBox_Right) CheckBoxGadget(4, 10, 130, 250, 20, "CheckBox center", #PB_CheckBox_Center) Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow EndIf
Supported OS
All