Board index » delphi » combobox question

combobox question


2003-08-19 11:02:52 PM
delphi248
I'm using a ComboBox. How can I force the user pick from the list and don't
allow free form entry?
--
Thanks!
-----------------------
Haizheng Sun
 
 

Re:combobox question

Set the combobox's "Style"-property to csDropDownList.
Stefan
 

Re:combobox question

hi, i have two questions:
1-My work put me on VC++ to develop a pretty simple GUI app. I just want to make sure that the VCL on Borland and VC++ share the same definitions. (i.e.-the combo boxes and other components share the same methods, properties, etc.. )
2-if so, then my question is this = I haven't worked with GUI stuff for awhile. I am wondering how I access the currently selected item in a combo box. Is it the 'Text' property, or is that just the initial value? do i need to do like MyComboBox->Items[get_selected_index()]? Thanks
 

Re:combobox question

To read the selected item
ComboBox1->Text;
To write something into the box
ComboBox1->SelText = "something";
To add items to the drop down list
ComboBox1->Items->Add("Albert Einstein");
ComboBox1->Items->Add("Fermi");
ComboBox1->Items->Add("Max Plank");
"It is not wise to count your money twice in a place where inflation is
high, as the second time you might have less". Rodolfo, 2003
"peter" <XXXX@XXXXX.COM>writes
Quote

hi, i have two questions:
1-My work put me on VC++ to develop a pretty simple GUI app. I just want
to make sure that the VCL on Borland and VC++ share the same definitions.
(i.e.-the combo boxes and other components share the same methods,
properties, etc.. )
Quote
2-if so, then my question is this = I haven't worked with GUI stuff for
awhile. I am wondering how I access the currently selected item in a combo
box. Is it the 'Text' property, or is that just the initial value? do i need
to do like MyComboBox->Items[get_selected_index()]? Thanks
 

Re:combobox question

If you meant the selected item via the drop down menu, then you could
use
ComboBox1->Items->Strings[ComboBox1->ItemIndex];
Rodolfo