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

# TCustomRadioGroup.ItemIndex

The ordinal position in Items for the selected radio button in the group.

## Declaration

Source position: extctrls.pp line 774

`public property TCustomRadioGroup.ItemIndex : Integer read GetItemIndex write SetItemIndex default - 1;`

## Description

ItemIndex is an Integer property with the ordinal position for the selected radio button in the group. It refers to the position in Items with the caption for the radio button. The default value for the property is -1, and indicates that a radio button is not selected for the group.

ItemIndex must be in the range -1..Items.Count-1. An Exception is raised with the message in rsIndexOutOfBounds if an invalid value is used.

When the value for the property is changed, the OnClick event handler is signalled (when assigned). In addition, the OnSelectionChanged is signalled (when assigned). Both events occur even if the Handle has not been allocated in the widgetset class. This is Delphi compatible.

Use the OnItemEnter and OnItemExit event handlers to perform actions when the focus or selection for a radio button is changed, as opposed to a change in the properties for the group control.

Remark: | Some widgetsets do not allow a radio button group to be unselected, or have no selected radio button. For this reason, a hidden radio button exists in TCustomRadioGroup and is selected when ItemIndex is set to -1.

## See also

TCustomRadioGroup.Items |  | Contains the captions for the radio button displayed in the control.
TCustomRadioGroup.OnClick |  | Event called when the selected item is changed.
TCustomRadioGroup.OnSelectionChanged |  | Event called when the selected item changes.
TCustomRadioGroup.OnItemEnter |  | Event handler signalled when a radio button in the group receives focus.
TCustomRadioGroup.OnItemExit |  | Event handler signalled when a radio button in the group loses focus.