tomascz
tomascz

Reputation: 245

WinAPI ComboBox shows no dropdown list

How is that a ComboBox contorl shows no dropdown list when I press its arrow button? To be precise, it "attempts" to show something but it looks like it had not enough space on the screen so that just a thin line is shown (like it was a "listbox with zero items"). When I use the up and down arrows, I can traverse through available options in the ComboBox. This picture demonstrates (note the black line below the ComboBox that has just appeared as a response to my attempt to show the dropdown list), http://nestorovic.hyperlink.cz/comboBoxProblem.PNG . May it be that there's a bounding rectangle around the ComboBox that the listbox attempts to fit in? How can such rectangle be increased? Thanks for a reply!

Upvotes: 1

Views: 2164

Answers (2)

andrius
andrius

Reputation: 106

I had same problem with combobox. for me solution was simple. You just need to make button height higher. When i made button height 25 there was just black thin line. But when i made height 200 then all my list appeared on button push.

        HWND hwndChannelList = CreateWindow(
        L"COMBOBOX",  // Predefined class; Unicode assumed 
        L"",      // Button text 
        WS_VISIBLE | WS_CHILD | CBS_DROPDOWNLIST | BS_DEFSPLITBUTTON | CBS_DROPDOWN | CBS_HASSTRINGS | WS_VSCROLL,  // Styles WS_VSCROLL | BS_DEFSPLITBUTTON WS_DISABLED | 
        10,         // x position 
        80,         // y position 
        100,        // Button width
        200,        // Button height
        hWnd,     // Parent window
        (HMENU)IDC_CHANNEL_COUT_BUTTON,       //menu.
        (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE),
        NULL);   

Upvotes: 5

tomascz
tomascz

Reputation: 245

Got it! There's indeed a bounding rectangle which I had to increase using the GetClientRect and SetWindowPos functions, http://nestorovic.hyperlink.cz/comboBoxSolved.PNG .

Upvotes: 1

Related Questions