From Xojo Documentation

Revision as of 18:22, 23 July 2021 by Gperlman (talk | contribs)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from DesktopUIControl)

New in 2021r3

The standard checkbox control used by desktop apps.

For web apps, see WebCheckBox.
Closing FocusLost MouseMove
ConstructContextualMenu FocusReceived MouseUp
ContextualMenuItemSelected KeyDown MouseWheel
DragEnter KeyUp Opening
DragExit MouseDown ValueChanged
DragOver MouseEnter
DropObject MouseExit
Active fa-lock-32.png Index fa-lock-32.png Scope fa-lock-32.png
AllowAutoDeactivate Italic TabIndex
AllowTabStop Left Tooltip
Bold LockBottom Top
Caption LockLeft Transparent
Enabled LockRight Underline
FontName LockTop Value
FontSize MouseCursor Visible
FontUnit Name fa-lock-32.png VisualState
Handle fa-lock-32.png PanelIndex Width
Height Parent Window fa-lock-32.png
AcceptFileDrop AcceptTextDrop Refresh
AcceptPictureDrop Close SetFocus
AcceptRawDataDrop DrawInto


Checkboxes can have three states:

CheckBox VisualStates.png

The Caption text does not wrap.

Sample Code

The following code in the DesktopCheckBox's ValueChanged event handler checks the value of the CheckBox:

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

Because DesktopCheckbox is a three-state control, you can use the VisualState property to get and set its value. The DesktopCheckBox.VisualStates Enumeration is designed to get and set the values.

The following code sets the VisualState property of a DesktopCheckBox to Indeterminate.

CheckBox1.VisualState = CheckBox.VisualStates.Indeterminate

Because VisualState 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.VisualState
Case CheckBox.VisualStates.Unchecked
// The CheckBox is unchecked

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

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

End Select

See the entries for VisualState and Value for additional examples of setting and getting DesktopCheckBox values. See also the DesktopCheckBox.VisualStates Enumeration.

See Also

DesktopRadioGroup control