CalculateCheckStates(TcxEditValue,IcxCheckItems,TcxCheckStatesValueFormat,TcxCheckStates) Method
Calculates check box states for the specified edit value.
Declaration
function CalculateCheckStates(const AValue: TcxEditValue; AItems: IcxCheckItems; AValueFormat: TcxCheckStatesValueFormat; var ACheckStates: TcxCheckStates): Boolean;
Parameters
Name | Type | Description |
---|---|---|
AValue | TcxEditValue | The source edit value. |
AItems | IcxCheckItems | Check box items of the source editor with multiple check boxes, for example, the Properties.Items property of a TcxCheckGroup editor. |
AValueFormat | TcxCheckStatesValueFormat | The check box state value format. This parameter value specifies how the function interprets source edit value ( |
ACheckStates | TcxCheckStates | This var parameter returns the calculated array of check box states. |
Returns
Type | Description |
---|---|
Boolean |
|
Remarks
You can call CalculateCheckStates
and CalculateCheckStatesValue global functions to convert a combination of individual check box states into an edit value and vice versa. These operations can be useful for scenarios that involve interaction between editors with multiple check boxes (such as check groups and check combo boxes) and dataset fields.
Code Example
The following code example lists all states of an in-place TcxCheckComboBox editor in a TcxMemo editor:
uses
..., cxCheckBox; // This unit contains the CalculateCheckStates function declaration
//...
procedure TMyForm.cxButton1Click(Sender: TObject);
var
AProperties: TcxCheckComboBoxProperties;
AValue: TcxEditValue;
ACheckStates: TcxCheckStates;
I: Integer;
begin
AValue := cxBarEditItem1.EditValue;
AProperties := cxBarEditItem1.Properties as TcxCheckComboBoxProperties;
CalculateCheckStates(AValue, AProperties.Items, AProperties.EditValueFormat, ACheckStates);
cxMemo1.Clear;
for I := 0 to Length(ACheckStates) - 1 do
if ACheckStates[I] = cbsChecked then
cxMemo1.Lines.Add('Checked');
else
cxMemo1.Lines.Add('Unchecked');
end;