Menu

Combo Box DropDown empty?

2005-04-08
2012-09-26
  • Indrek Sünter

    Indrek Sünter - 2005-04-08

    Hello, I added a ComboBox to my application, i used CB_INSERTSTRING or CB_ADDSTRING to add strings to the list. I then set the ComboBox's current selection by sending CB_SETCURSEL message. All these messages are sent in WindowProcedure in case of WM_INITDIALOG message.
    But when i test it, the ComboBox seems to be empty, as it only shows a black line, when clicking the down arrow, despite the fact that it isn't empty. When i pressed down or up keys, the selection changes, but the DropDown still shows only a thin black line.

    ComboBox in main.rc:
    COMBOBOX Combo1, 37, 9, 75, 11, WS_CHILD | WS_TABSTOP | WS_VISIBLE | CBS_DROPDOWN | WS_VSCROLL

    The messages i sent to Combo1:
    SendDlgItemMessage(hwnd, Combo1, CB_INSERTSTRING, (WPARAM)0, (LPARAM)(LPCTSTR) "Easy");

    SendDlgItemMessage(hwnd, Combo1, CB_INSERTSTRING, (WPARAM)1, (LPARAM)(LPCTSTR) "Hard");

    SendDlgItemMessage(hwnd, Combo1, CB_SETCURSEL, (WPARAM)0, (LPARAM)0);

    The identifier of the ComboBox isn't equal to any other's ID. So that can't be the problem.

    Could compiler Command-Line definitions "-D_WIN32_WINNT=0x0501" and "-D_WIN32_IE=0x0600" affect the ComboBox's behaviour?
    Or do i have to include something in addition to windows.h and commctrl.h?

    All suggestions are welcome, Thank You..

     
    • Indrek Sünter

      Indrek Sünter - 2005-04-08

      Thank You, it worked..

       
    • Nobody/Anonymous

      Try to increase the height of the combobox. You have to adjust for the nr. of elements you will show. Test with 50 instead of 11, should do it.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.