Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About Comboboxes.

Status
Not open for further replies.

zikar

Programmer
Oct 10, 2000
31
JP
Hi,

I am trying to use a combobox in a Borland CBuilder project.

How can I make this combobox readonly ?

The user should be able to choose items from the combobox.
He or she should not be able to write in to it.

Thanks for any useful tip.

Michel
 
void __fastcall TForm1::ComboBox1KeyPress(TObject *Sender, char &Key)
{
Key = NULL;
}

tomcruz.net
 
Another way is (as i recall) to set it's Style (in Properties) to "csDropDownList".......
It COULD be one of the other Styles, try another if i'm remembering wrong, one of them does the job!

Totte
 
Hi,

Now I need to control the input in a Combo Box.

Say the character 'X' should be present one time and only once.

That means I do not want the user to be able to input a second 'X' character. And I do not want him (or her) to delete this 'X' character.

The logic is simple but I just need to know which character the user is trying to add or delete. In other words I want to know the cursor position in the combo (or edit) box.
How do I know this postition ?

Michel
 
Well well.....what do You know....tried a little and it turns out that ComboBox->SelStart actually corrospond to the location where You put in the keypress when you input manually. So catch the keypress event and do the woodoo You do so well using the SelStart.

Totte
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top