I'm coding an app in MSVS 2008, which has a ComboBox control which I initialize thru the code as below:
static char* OptionString[4] = {"Opt1",
"Opt2",
"Opt3",
"Opt4"};
BOOL CMyAppDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_Option.AddString(OptionString[0]);
m_Option.AddString(OptionString[1]);
m_Option.AddString(OptionString[2]);
m_Option.AddString(OptionString[3]);
m_Option.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
}
In the above code, m_Option
is the Control variable for the ComboBox Control.
Now, when I build the app and click the down-arrow, the drop-down box shows the first option ONLY(since I've selected that thru my code). But, if i press down-arrow key on keyboard, it cycles thru the options in the order I've inserted, but never does it show more than 1 option in the box. So, In case an user wants to select option3, he has to cycle through options 1 and 2 !! Though once I select any option using the keyboard, the appropriate event handlers are fired, I'm miffed by this behaviour , as is understandable.
I'm listing the properties of the combo-box control as well - only the properties that are true(rest are set to false):
- Type - Dropdown
- Vertical Scrollbar
- Visible Tabstop
This has bugged me for weeks now. Can anyone pls enlighten me ?