wxRuby Documentation Home

Wx::CheckBox

A checkbox is a labelled box which by default is either on (checkmark is
visible) or off (no checkmark). Optionally (when the CHK_3STATE style flag
is set) it can have a third state, called the mixed or undetermined state.
Often this is used as a “Does Not Apply” state.

Derived from

Control

Window

EvtHandler

Object

Window styles

CHK_2STATE Create a 2-state checkbox. This is the default.
CHK_3STATE Create a 3-state checkbox.Not implemented in MGL, OS2 and GTK built against GTK+ 1.2.
CHK_ALLOW_3RD_STATE_FOR_USER By default a user can’t set a 3-state checkboxto 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.
ALIGN_RIGHT Makes the text appear on the left of the checkbox.

See also window styles overview.

Event handling

evt_checkbox(id) { | event | … } Process a EVT_COMMAND_CHECKBOX_CLICKED event,when the checkbox is clicked.

See also

RadioButton, CommandEvent

Methods

CheckBox.new

CheckBox.new(%(arg-type)Window% parent, Integer id, String label, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = 0, Validator val, String name = “checkBox”)

Constructor, creating and showing a checkbox.

Parameters

See also

CheckBox#create, Validator

destructor()

Destructor, destroying the checkbox.

CheckBox#create

Boolean create(%(arg-type)Window% parent, Integer id, String label, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style = 0, Validator val, String name = “checkBox”)

Creates the checkbox for two-step construction. See CheckBox.new for details.

CheckBox#get_value

Boolean get_value()

Gets the state of a 2-state checkbox.

Return value

Returns if it is checked, otherwise.

CheckBox#get_3_state_value

CheckBoxState get_3_state_value()

Gets the state of a 3-state checkbox.

Return value

Returns CHK_UNCHECKED when the checkbox is unchecked, CHK_CHECKED
when it is checked and CHK_UNDETERMINED when it’s in the undetermined
state. Asserts when the function is used with a 2-state checkbox.

CheckBox#is_3_rd_state_allowed_for_user

Boolean is_3_rd_state_allowed_for_user()

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

Return value

Returns if the user can set the third state of this checkbox, if it can only be set
programmatically or if it’s a 2-state checkbox.

CheckBox#is_3_state

Boolean is_3_state()

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

Return value

Returns if this checkbox is a 3-state checkbox, if it’s a 2-state checkbox.

CheckBox#is_checked

Boolean is_checked()

This is just a maybe more readable synonym for
get_value: just as the latter, it returns
if the checkbox is checked and otherwise.

CheckBox#set_value

set_value(%(arg-type)Boolean% state)

Sets the checkbox to the given state. This does not cause a
EVT_COMMAND_CHECKBOX_CLICKED event to get emitted.

Parameters

CheckBox#set_3_state_value

set_3_state_value(%(arg-type)CheckBoxState% state)

Sets the checkbox to the given state. This does not cause a
EVT_COMMAND_CHECKBOX_CLICKED event to get emitted.

Parameters

[This page automatically generated from the Textile source at 2023-06-03 08:07:40 +0000]