1000 Text
1001 Another text
2000 Third text
The number in column 0, the text in column 1
Somethink like "aColumnComboBox.ComboItems[0,0].add" ?
Is there a sample/documentation describing how to do this?
Regards,
Ole
1000 Text
1001 Another text
2000 Third text
The number in column 0, the text in column 1
Somethink like "aColumnComboBox.ComboItems[0,0].add" ?
Is there a sample/documentation describing how to do this?
Regards,
Ole
If you have 2 columns:
var
cbi: TComboItem;
begin
ColumnComboBox1.BeginUpdate;
cbi := ColumnComboBox1.ComboItems.Add;
cbi.Strings.Add('col 0 r ' + cbi.Index.ToString);
cbi.Strings.Add('col 1 r ' + cbi.Index.ToString);
ColumnComboBox1.EndUpdate;
end;
Thanks for the answer, I can now poulate the Columnbox.
But how do I read the string value from the first column?
First column in row 1: 1000
Second column in row 1:This is a text
I want the value 1000 read into a variable.
Regards
Ole
I tried this,
s:=aColumnBox.ColumnItems[0,0]; // Always the first row in the list
s:=aColumnBox.ColumnItems[0,aColumnBox.ItemIndex]; // Gives me not the selected value
This fills the combobox with 2 columns and reads back the first column values and adds these to a listbox:
var
cbi: TComboItem;
i: integer;
begin
ColumnComboBox1.Columns.Add;
ColumnComboBox1.Columns.Add;
ColumnComboBox1.BeginUpdate;
for i := 0 to 10 do
begin
cbi := ColumnComboBox1.ComboItems.Add;
cbi.Strings.Add('col 0 r ' + cbi.Index.ToString);
cbi.Strings.Add('col 1 r ' + cbi.Index.ToString);
end;
ColumnComboBox1.EndUpdate;
for i := 0 to 10 do
begin
cbi := ColumnComboBox1.ComboItems[i];
ListBox1.Items.Add(cbi.Strings[0]);
end;
end;