Click to See Complete Forum and Search --> : combobox


May 19th, 1999, 10:36 AM
Users are allowed only to pick an item in the list. How to achieve that?

I am thinking to intercept "Setforcus" message, and send "dropdown" list message. How should I do that?

Thanks!

Daohui Li

May 19th, 1999, 11:38 AM
Combo boxes are very versatile, but lets keep it simple, lets, suppose you want to specify the contents yourself.
(Study the class members of CComboBox)

m_MyCombo.AddString("Bert");
m_MyCombo.AddString("Fred");
m_MyCombo.AddString("Tim");

m_MyCombo.SelectString(0);

Set properties of your combo to Dropdownlist, and this stop character input in the combo, and only allow a selection.

Use GetCurSel() to retrieve the item index selected
Use GetLBText() to get the text at a given index

I hope I have been helpful