Skip to main content

CalculateCheckStatesValue(TcxCheckStates,IcxCheckItems,TcxCheckStatesValueFormat) Method

Calculates an edit value from specified check box item states.

Declaration

function CalculateCheckStatesValue(const ACheckStates: TcxCheckStates; AItems: IcxCheckItems; AValueFormat: TcxCheckStatesValueFormat): TcxEditValue;

Parameters

Name Type Description
ACheckStates TcxCheckStates

The source array of check box states.

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 the required data format of the calculated edit value.

Returns

Type Description
TcxEditValue

The calculated edit value.

The AValueFormat parameter defines the value’s format.

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 initializes the states of three check box items in an in-place TcxCheckComboBox editor:

uses
..., cxCheckBox;  // This unit contains the CalculateCheckStatesValue function declaration
//...
procedure TMyForm.cxButton1Click(Sender: TObject);
var
  AProperties: TcxCheckComboBoxProperties;
begin
  AProperties := cxBarEditItem1.Properties as TcxCheckComboBoxProperties;
  cxBarEditItem1.EditValue := CalculateCheckStatesValue([cbsChecked, cbsUnchecked, cbsChecked],
     AProperties.Items, AProperties.EditValueFormat);
end;
See Also