Compartir a través de


CheckBox Control

Creates a check box.

CheckBox

Remarks

You can use a check box to switch between three states, True (.T.), False (.F.), and Null (.NULL.). The CheckBox Value property determines the current state of the check box.

The following table illustrates the three possible states that a check box can have.

Display

Value property

Description

FoxCheckBox 1 button

0 or .F. (Default)

Not selected.

FoxCheckbox 2 button

1 or .T.

Selected.

FoxCheckBox 3 button

2 or .NULL.

Selected but dimmed.

This state makes it possible for the application user to decline from selecting the check box. However, the application user can clear and then select the check box.

Tip

After interacting with the check box, the user can return the check box to the original null state by pressing CTRL+0.

The CheckBox Value property reflects the data type of the last assignment. For example, if you set the property to True (.T.) or False (.F.), the type is Logical until you set the property to a Numeric value.

If you set the CheckBox ControlSource property of the check box to a logical field in a table, the check box displays as follows:

  • As selected when the value in the current record is True (.T.).

  • As not selected when the value in the current record is False (.F.).

  • As selected but dimmed if the value in the current record is null (.NULL.).

    Note

    If the ControlSource property is a field in a table that does not accept a null value, pressing CTRL+0 generates an error.

To specify the text that appears next to a check box, use the Caption property. To specify a picture for a check box, use the Picture property.

For additional information about CheckBox controls, see How to: Use Check Boxes to Specify States.

See Also

Reference

CheckBox Control Properties, Methods, and Events

CREATE CLASS Command

CREATE FORM Command

DEFINE CLASS Command

Other Resources

Objects, Collections, and Classes

Language Reference (Visual FoxPro)