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

TcxCustomCheckComboBox.SetItemState(Integer,TcxCheckBoxState) Method

Sets the checked state of an item.

#Declaration

Delphi
procedure SetItemState(AIndex: Integer; AState: TcxCheckBoxState);

#Parameters

Name Type
AIndex Integer
AState TcxCheckBoxState

#Remarks

The SetItemState method enables you to change the checked state of an item at runtime. The item is addressed by the AIndex parameter specifying the item’s zero based position within the collection. The new state is specified by the AState parameter.

The TcxCheckBoxState type provides three enumerated values (cbsUnchecked, cbsChecked and cbsGrayed) representing states for a check box control. However, items within a check combo box control only support two states: checked and unchecked. So if AState is cbsGrayed, the method does nothing.

The SetItemState method does not affect the enabled status of the item. To get/set the item’s enabled state, use the Enabled property.

The end-user can toggle an item’s check state by clicking its check box in the dropdown window or by pressing the spacebar while the item is focused. The following images show items with checked and unchecked states:

Checked item Unchecked item

The text displayed in the edit box of the editor reflects the state of all checked items. When you uncheck a specific item, it is automatically removed from the edit box.

To get the check state of a particular item, see the GetItemState method.

The following example checks the first item and unchecks the second:

Delphi
MycxCheckComboBox.SetItemState(0, cbsChecked);
MycxCheckComboBox.SetItemState(1, cbsUnchecked);
See Also