Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

CalculateCheckStatesValue(TcxCheckStates,IcxCheckItems,TcxCheckStatesValueFormat) Method

Calculates an edit value from specified check box item states.

#Declaration

Delphi
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: Initialize Check Combo Box States

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