[RESOLVED] Combobox dropdown does not react to mouse input
If I click the dropdown arrow on my combobox the dropdown menu appears correctly, but I can only control it using the keyboard. It does not react to mouse input. What is going wrong here?
[187 byte] By [
philkr] at [2007-11-19 19:33:31]

# 1 Re: [RESOLVED] Combobox dropdown does not react to mouse input
I tried the following and it works fine:
HWND hComboBox;
hComboBox = CreateWindowEx(WS_EX_CLIENTEDGE, "COMBOBOX", "",
WS_CHILD | WS_VISIBLE | CBS_SIMPLE | CBS_DROPDOWN,
0, 0, 100, 100, hwnd, (HMENU)IDC_COMBO, GetModuleHandle(NULL), NULL);
SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) "Item1");
SendMessage (hComboBox, CB_ADDSTRING, 0, (LPARAM) "Item2");
if(hComboBox == NULL)
MessageBox(hwnd, "Could not create.", "Error", MB_OK | MB_ICONERROR);
Can you post your code?
logan at 2007-11-9 13:20:20 >

# 2 Re: [RESOLVED] Combobox dropdown does not react to mouse input
I'm glad somebody tries to help me. Here is a part of the resource script:
IDD_MAIN DIALOGEX 0, 0, 504, 41
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_BORDER
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL 103,IDC_STATIC,"Static",SS_BITMAP,0,0,504,40
COMBOBOX IDC_STREAMURL,375,22,114,54,CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Exit",IDCANCEL,463,6,26,14
DEFPUSHBUTTON "Connect",IDOK,416,6,37,14
PUSHBUTTON "Play",IDC_PLAY,266,6,28,13
PUSHBUTTON "Stop",IDC_STOP,304,6,28,13
PUSHBUTTON "Save this song!",IDC_SAVESONG,343,6,61,13
CTEXT "unknown Song",IDC_SONGNAME,194,22,175,9,SS_SUNKEN | NOT WS_GROUP
CTEXT "unknown Station",IDC_STATION,17,7,162,10,SS_SUNKEN | NOT WS_GROUP
CTEXT "Genre",IDC_GENRE,194,7,51,10,SS_SUNKEN | NOT WS_GROUP
CTEXT "unknown URL",IDC_URL,17,22,162,9,SS_SUNKEN | NOT WS_GROUP
END
philkr at 2007-11-9 13:21:21 >

# 3 Re: [RESOLVED] Combobox dropdown does not react to mouse input
I found the error. It had something to do with the message loop for the dialog.
I had it like this:
while(GetMessage(&msg, hDlg, 0, 0) > 0)
{
if(!IsDialogMessage(hDlg, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
But it must have been like this:
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
if(!IsDialogMessage(hDlg, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
philkr at 2007-11-9 13:22:19 >
