The ItemIndex works for TComboBoxEx in the same way as for TComboBox:
ComboBoxEx1.ItemIndex := 1; // Select the 2nd item (having index 1)
Retrieving the item caption is a bit more complicated since the property ItemsEx[index] returns the full item instance at the given index. But there's a property Caption for the text of of that item:
ShowMessage(ComboBoxEx1.ItemsEx[CombBoxEx1.ItemIndex].Caption);
Other properties of the ItemsEx[index] are:
- ImageIndex
- OverlayImageIndex
- SelectedImageIndex
- Indent
(Just what is available when you populate the items by the '...' button next to ItemsEx in the object inspector).
Unlike a TCombobox which is populated by calling ComboBox1.Add(text_of_the_item) you populate the TComboBoxEx at runtime this way:
with ComboBoxEx1.ItemsEx.Add do
begin
Caption := text_of_the_item;
ImageIndex := 15;
SelectedImageIndex := 15;
end;
// or quicker, if you only want to set the caption
ComboBox1.ItemsEx.Add.Caption := text_of_the_item;
The property Text is not available since the displayed text cannot be edited. I don't know why it is published.