Back to Devexpress

TcxImageComboBoxItems Class

vcl-cximagecombobox-3619fcf7.md

latest4.1 KB
Original Source

TcxImageComboBoxItems Class

A collection of image combo box items.

Declaration

delphi
TcxImageComboBoxItems = class(
    TOwnedCollection
)

Remarks

TcxImageComboBox and TcxDBImageComboBox editors use a TcxImageComboBoxItems collection to manage items available for selection.

Main API Members

The list below outlines key members of the TcxImageComboBoxItems class. These members allow you to manage image combo box items.

Collection Management

AddCreates a new image combo box item and adds it to the end of the collection.ClearClears the collection.CountReturns the number of stored image combo box items.DeleteAllows you to delete individual image combo box items.ItemsProvides indexed access to stored image combo box items.

General-Purpose API Members

AssignCopies items between image combo box item collections.BeginUpdate | EndUpdateAllow you to avoid excessive redraw operations during batch collection changes.

Code Example: Create and Configure Image Combo Box Items

The following code example creates and configures four image combo box items:

delphi
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;
cpp
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;

Direct TcxImageComboBoxItems Class Reference

The TcxCustomImageComboBoxProperties.Items property references a TcxImageComboBoxItems object.

Inheritance

TObject TPersistent TCollection TOwnedCollection TcxImageComboBoxItems

See Also

TcxImageComboBoxItems Members

cxImageComboBox Unit