DesktopCheckBox.VisualState

From Xojo Documentation

Property (As DesktopCheckBox.VisualStates Enumeration )
aDesktopCheckBox.VisualState = newDesktopCheckBox.VisualStates EnumerationValue
or
DesktopCheckBox.VisualStates EnumerationValue = aDesktopCheckBox.VisualState

New in 2021r3

Supported for all project types and targets.

Gets or sets the state of the DesktopCheckBox.

Notes

A DesktopCheckBox can be in one of three states: Checked, Unchecked, or Indeterminate (see below). Use the DesktopCheckBox.VisualStates enumeration to set or read the value of State.

CheckBox VisualStates.png

Setting the value of VisualState automatically updates the Value property. Changing the DesktopCheckBox.VisualState to Checked or Indeterminate updates the Value property and sets it to True.

Neither changing the VisualState property to indeterminate nor setting it to the value that matches the current Value property will fire the ValueChanged event.

Sample Code

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

Checkbox1.VisualState = DesktopCheckBox.VisualStates.Indeterminate

Because VisualState is an Enumeration, you cannot use the corresponding Integer value for comparison. The following code shows how to use VisualState 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