[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'CheckLst' (#lcl)

# TCustomCheckListBox.Toggle

Toggles the Checked, Unchecked, Grayed state for the specified item in the control.

## Declaration

Source position: checklst.pas line 75

`public procedure TCustomCheckListBox.Toggle(`
`AIndex: Integer`
`);`

## Arguments

`AIndex` |  | Ordinal position of the item state toggled in the method.

## Description

Toggle is a procedure used to toggle the checked, unchecked, or grayed state for the item at the specified position in Items.

Toggle ensures the value in the AllowGrayed property is respected in the operation. When AllowGrayed is True, the following order is used for toggling to the next available check box state:

- cbUnchecked
- cbChecked
- cbGrayed
- Cycle to cbUnchecked

When AllowGrayed is False, the following order is used for toggling to the next available check box state:

- cbUnchecked
- cbChecked
- Cycle to cbUnchecked

Use Checked to set a specific item to a specified Boolean checked state value. Use State to get or set the check box state as a TCheckBoxState value. Use CheckAll to change the checked state and disposition for all Items in the control.

## See also

TCustomCheckListBox.AllowGrayed |  | Indicates if the item can use the "grayed" (or unselectable) check box state.
TCustomCheckListBox.Checked |  | Provides indexed access to the Boolean Checked or Unchecked state for Items in the control.
TCustomCheckListBox.State |  | Provides indexed access to the TCheckBoxState for Items in the control.
TCustomCheckListBox.CheckAll |  | Sets the specified values for State, AllowGrayed, and ItemEnabled for all Items in Control.
TCheckBoxState
TCustomListBox.Items |  | The list of all items defined in the control.