Jan 27, 2016 at 5:34am UTC
I want the user to select from a drop-down list of items in a combo box. I have called the WM_CREATE function and the user can input text. Here, I've been able to add 'Item 2', 'Item 1' seems not to show. What should I do? This is what I have
#define WC_COMBOBOX
case WM_CREATE: {
// CREATE COMBO BOX
HWND hWndComboBox = CreateWindow (TEXT("COMBOBOX"), TEXT (""),
CBS_DROPDOWN | CBS_HASSTRINGS | WS_VISIBLE | WS_CHILD | WS_BORDER,
100, 20, 200, 20,
hwnd,(HMENU) NULL, NULL, NULL);
// ADD 2 ITEMS SendMessage ( hWndComboBox, (UINT) CB_ADDSTRING , (WPARAM) 0, (LPARAM) TEXT ("Item 1")); SendMessage ( hWndComboBox, (UINT) CB_ADDSTRING, (WPARAM) 0, (LPARAM) TEXT ("Item 2"));
// SEND THE CB_SETCURSEL MESSAGE TO DISPLAY AN INITIAL ITEM IN SELECTION FIELD SendMessage (hWndComboBox, CB_SETCURSEL, (WPARAM) 1, (LPARAM) 0);
Jan 27, 2016 at 11:08am UTC
Maybe it's a problem with the drop down list being too small for two items?
Jan 27, 2016 at 1:35pm UTC
coder777 was right. When the height of the combobox is >= 80 both items show.