vcl-cximagecombobox-654be59c.md
An image combo box item.
TcxImageComboBoxItem = class(
TCollectionItem
)
Like in a simple combo box, a selected image combo box item is associated with an edit value. In addition, image combo box items can display images and corresponding descriptions.
The list below outlines key members of the TcxImageComboBoxItem class. These members allow you to configure image combo box items.
Provides access to the parent collection.
Tip
You need to cast the property value to the TcxImageComboBoxItems class to access all public API members.
Description | ImageIndexSpecify the item’s description and image.IndexSpecifies the item’s index in the parent collection.TagAllows you to associate the image combo box item with an integer value (a pointer, for example).Value
Specifies the edit value associated with the image combo box item.
Note
Make sure that all items in the same image combo box editor have unique Value property values. If an image combo box has two or more items with identical values, the editor can display only the first item when one of them is selected.
The following code example creates and configures four image combo box items:
var
AItem: TcxImageComboBoxItem;
AProperties: TcxImageComboBoxProperties;
begin
AProperties := cxImageComboBox1.Properties;
AProperties.BeginUpdate;
try
AItem := AProperties.Items.Add;
AItem.ImageIndex := 0;
AItem.Description := 'Dr';
AItem.Value := 0;
AItem := AProperties.Items.Add;
AItem.ImageIndex := 1;
AItem.Description := 'Mr';
AItem.Value := 1;
AItem := AProperties.Items.Add;
AItem.ImageIndex := 2;
AItem.Description := 'Ms';
AItem.Value := 2;
AItem := AProperties.Items.Add;
AItem.ImageIndex := 3;
AItem.Description := 'Mrs';
AItem.Value := 3;
finally
AProperties.EndUpdate;
end;
cxImageComboBox1.EditValue := 0;
end;
TcxImageComboBoxItem *AItem;
TcxImageComboBoxProperties *AProperties;
// ...
AProperties = cxImageComboBox1->Properties;
AProperties->BeginUpdate();
try
{
AItem = AProperties->Items->Add();
AItem->ImageIndex = 0;
AItem->Description = "Dr";
AItem->Value = 0;
AItem = AProperties->Items->Add();
AItem->ImageIndex = 1;
AItem->Description = "Mr";
AItem->Value = 1;
AItem = AProperties->Items->Add();
AItem->ImageIndex = 2;
AItem->Description = "Ms";
AItem->Value = 2;
AItem = AProperties->Items->Add();
}
__finally
{
AProperties->EndUpdate();
}
cxImageComboBox1->EditValue = 0;
The following public API members reference a TcxImageComboBoxItem object:
TcxImageComboBoxItems.AddCreates a new image combo box item and adds it to the end of the collection.TcxImageComboBoxItems.ItemsProvides indexed access to image combo box items.
TObject TPersistent TCollectionItem TcxImageComboBoxItem
See Also