Skip to main content

TcxDBCheckBox Class

Represents a data-aware control which supports “checked”, “unchecked” and “grayed” states.

Declaration

TcxDBCheckBox = class(
    TcxCustomCheckBox
)

Remarks

Like TcxCheckBox, a TcxDBCheckBox control represents an option. A user can set a check box to one of three states: checked, unchecked and grayed. By default, only checked and unchecked states are available. To enable a user to set a grayed state you should assign True to the AllowGrayed member of the Properties object. A user can switch between states by clicking an editor with the mouse or pressing the keyboard space bar while the editor has focus. The following image displays a check box editor painted using the Windows® XP look & feel:

To connect a data-aware control to a dataset, set the DataSource and DataField properties of the DataBinding object.

You can associate specific values with every state via the ValueChecked, ValueUnchecked or ValueGrayed members of the Properties object. These values will be posted to the dataset when a user sets a check box to the corresponding state. Conversely, when your editor retrieves a dataset value, it is set to one of the three states:

Use the Properties and style (Style, StyleDisabled, StyleFocused and StyleHot) members to specify the behavior and look & feel of an editor. Working with styles is discussed in the TcxCustomEditStyle class topic.

To set the state programmatically, use either the Checked or the State property. The Checked property is of type Boolean and so can only identify only checked and unchecked states. The State property is more flexible and allows you to select one of the three states.

See Also