ComboBoxEx Control

Hierarchy: TObject - TPersistent - TComponent - TControl - TWinControl - TCustomListControl - TCustomCombo - TCustomComboBoxEx - TBiDiComboBoxEx - TComboBoxEx

This component provides some additional features to the standard ComboBox such as the facility to add images (those all-important pictures to improve usability and accessibility). It also provides some control over indenting.

The properties of ComboBoxEx are similar to those of a ComboBox. The ItemsEx property has a diaresis to open the list editor. The list editor includes properties for the Caption, the image and the amount of indentation:

In this example a ComboBoxEx control is used to store a list of tasks that someone might keep in files in a computer system - alarms, expenses, appointments, travel. When the ComboBoxEx is clicked the application looks for a file with the same name as the text and then opens it and displays it in a memo:

procedure TForm1.ComboBoxEx1Click(Sender: TObject);
var task, textline, taskfilename : string;
taskfile: textfile;
begin
 task:=ComboBoxEx1.Text;
 taskfilename:=task + '.txt';
 assignfile(taskfile, taskfilename);
 reset (taskfile);
 while not eof (taskfile) do
  begin
   readln(taskfile, textline);
   memo1.Lines.Add(textline);
  end;
end;

Back to Tutorial

Back to Palette List