[Overview][Constants][Types][Classes][Procedures and functions][Index] |
The check, unchecked, or grayed state for the control.
Source position: stdctrls.pp line 1359
public property TCustomCheckBox.State : TCheckBoxState |
State is a TCheckBoxState property which indicates whether the check box is checked, unchecked or grayed (disabled). The default value for the property is cbUnchecked. State allows the control to be set to the indeterminate (grayed) state when AllowGrayed is set to True. Otherwise, it has the same behavior as using the Checked property.
See TCheckBoxState for the available enumeration values and their meanings in the State property.
Reading the property value calls RetrieveState to get the value from the widgetset class when its handle has been allocated. Otherwise, the existing value for the member is used.
Changing the value for the property causes the Checked property in an assigned Action to be updated if the property value is not cbGrayed and the ClicksDisabled property is False. The value is applied to the Action without updating the value in the control. This prevents recursion when the value is changed in the linked action.
Otherwise, ApplyChanges is called to update the visual appearance for the control. DoClickOnChange is called to post the control message for the updated control, and to emulate the OnChange and OnClick behavior in the Delphi VCL. When ClicksDisabled is True, only the OnChange event handler is signalled. When set to False, the Click method is called to signal both the OnChange and OnClick event handlers (when assigned).
The Grayed property in Action is set to False when the new property value is cbChecked or cbUnchecked.
Modified in LCL version 3.0 to prevent recursive updates (and event notifications) when the action is changed.
|
Allows the check box to use a "grayed" state. |
|
|
Indicates the checked state for the control. |
|
|
Gets the checked state for the control from the widgetset class. |
|
|
Sets the checked state in the widgetset class and redraws the control. |
|
|
Implements the Click behavior for the control. |
|
|
Represents the states for a check box. |
|
|
True if the action (and it client control) are in the grayed or indeterminate state. |
{ This example uses a check box on a form. When the application runs, the check box is initially checked. When the user clicks it, the check box is unchecked. Clicking it again grays the check box. } procedure TForm1.FormCreate(Sender: TObject); begin Checkbox1.AllowGrayed := True; Checkbox1.State := cbChecked; end;
Version 3.2 | Generated 2024-02-25 | Home |