Checkbox

Checkbox is derived from Control class.

[lide.widgets] ^1.1 lide.widgets.controls.checkbox 1.0

A Checkbox is a control that contains a text string, and is one of the most common elements of a GUI.


Constructor

Checkbox class has a complex constructor:

object Checkbox:new {
               number ID, string Name,
               object Parent, Text = 'My Checkbox'
       }

Arguments

These arguments are received by class constructor.

Argument Description
Name The control name
Parent The control parent
PosX Position related to X
PosY Position related to Y
Flags

Possible style modificators for Checkbox control:

constant value description
Checkbox.CHK_2STATE 0 Create a 2-state checkbox. This is the default.
Checkbox.CHK_3STATE 4096 Create a 3-state checkbox. Not implemented in wxOS2 and wxGTK built against GTK+ 1.2.
Checkbox.CHK_ALLOW_3RD_STATE_FOR_USER 8192 By default a user can’t set a 3-state checkbox to the third state. It can only be done from code. Using this flags allows the user to set the checkbox to the third state by clicking.
Checkbox.ALIGN_RIGHT 512 Makes the text appear on the left of the checkbox

Events

The following events are emitted by this class:

Event name Description
Widget.onEnter When the mouse moves onto this widget.
Widget.onLeave When the mouse moves out to this widget.
Checkbox.onClick When the user clicks on this Checkbox.

Inherited Methods

These methods are inherited from its super classes:

Class Method Description
Object:getID Returns object’s identifier.
Object:setID Sets the object identifier.
Object:getName Returns object’s name.
Object:setName Sets the object name.
Widget:getParent Returns object’s parent.
Widget:setParent Sets the object parent.
Widget:getPosX Returns object’s position related to X.
Widget:setPosX Sets the object position related to X.
Widget:getPosY Returns object’s position related to Y.
Widget:setPosY Sets the object position related to Y.
Widget:getWidth Returns object’s width.
Widget:setWidth Sets the object width.
Widget:getHeight Returns object’s height.
Widget:setHeight Sets the object height.
Widget:getBind Returns the wxWidgets object.

Checkbox:getValue

Gets the state of a 2-state checkbox.

Returns:
Returns true if it is checked, false otherwise.
bool Checkbox:getValue( )

Checkbox:get3StateValue

Gets the state of a 3-state checkbox.

Asserts when the function is used with a 2-state checkbox.

bool Checkbox:get3StateValue( )

Checkbox:is3rdStateAllowedForUser

Returns whether or not the user can set the checkbox to the third state.

Returns:
true if the user can set the third state of this checkbox, false if it can only be set programmatically or if it’s a 2-state checkbox.
bool Checkbox:is3rdStateAllowedForUser( )

Checkbox:is3State

Returns whether or not the checkbox is a 3-state checkbox.

Returns:
true if this checkbox is a 3-state checkbox, false if it’s a 2-state checkbox.
bool Checkbox:is3State( )

Checkbox:isChecked

This is just a maybe more readable synonym for GetValue(): just as the latter, it returns true if the checkbox is checked and false otherwise.
bool Checkbox:isChecked( )

Checkbox:setValue

Sets the checkbox to the given state.

This does not cause a Checkbox.onClick event to get emitted.

Parameters:
state If true, the check is on, otherwise it is off.
bool Checkbox:setValue( bool bState )

Checkbox:set3StateValue

Sets the checkbox to the given state.

This does not cause a Checkbox.onClick event to get emitted.

Asserts when the checkbox is a 2-state checkbox and setting the state to Checkbox.CHK_UNDETERMINED.

bool Checkbox:set3StateValue( number nCheckBoxState )