Checkbox

From Xojo Documentation
Jump to: navigation, search
For web applications, see WebCheckBox.

Class (inherits from RectControl)

The standard checkbox control used by desktop applications.

Events
Action DropObject MouseExit
Close GotFocus MouseMove
ConstructContextualMenu KeyDown MouseUp
ContextualMenuAction KeyUp MouseWheel
DragEnter LostFocus Open
DragExit MouseDown
DragOver MouseEnter


Properties
Active ReadOnlyProperty.png Left State
AutoDeactivate LockBottom TabIndex
Bold LockLeft TabStop
Caption LockRight TextFont
DataField LockTop TextSize
DataSource MouseCursor Top
Enabled MouseX ReadOnlyProperty.png TrueWindow ReadOnlyProperty.png
Handle ReadOnlyProperty.png MouseY ReadOnlyProperty.png Underline
Height Name Value
HelpTag PanelIndex Visible
Index ReadOnlyProperty.png Parent Width
Italic Scope ReadOnlyProperty.png Window ReadOnlyProperty.png


Methods
AcceptFileDrop Close RefreshRect
AcceptPictureDrop DrawInto SetBoolean
AcceptRawDataDrop Invalidate SetFocus
AcceptTextDrop Refresh

Notes

Checkboxes can have three states: CheckBox States.png


NOTE: The Caption text does not wrap.


Examples

The following code in the CheckBox’s Action event handler checks the value of the CheckBox.

If CheckBox1.Value Then
TextField1.Text = "True"
Else
TextField1.Text = "False"
End If

Because Checkbox is a three-state control, you can use the State property to get and set its value. The CheckedStates Enumeration is designed to get and set the values.

The following code sets the State property of a Checkbox to Indeterminate.

Checkbox1.State = Checkbox.CheckedStates.Indeterminate


Because State is an enumeration, you cannot use the corresponding integer value for comparison. The following code shows how to use State in a Select Case statement.

Select Case CheckBox1.State
Case CheckBox.CheckedStates.Unchecked
// The CheckBox is unchecked

Case CheckBox.CheckedStates.Checked
// The CheckBox is checked

Case CheckBox.CheckedStates.Indeterminate
// The CheckBox state is indeterminate

End Select


See the entries for State and Value for additional examples of setting and getting Checkbox values. See also the CheckedStates Enumeration.

See Also

RadioButton control; RectControl class.

Personal tools
Namespaces

Variants
Actions
Main
Content
Starting Out
Dig Deeper
More Help
Toolbox
About