Click to See Complete Forum and Search --> : No LBN_SELCHANGE from listbox


ReneG
January 26th, 2004, 11:15 AM
This problem is really pi**ing me off!!

I've created a listbox:

Listbox = CreateWindowEx(0, "LISTBOX", NULL, WS_BORDER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | LBS_NOTIFY,
MainWindow.ClientRect.right - LISTBOXWIDTH,
MainWindow.ClientRect.top + MainWindow.ToolbarHeight,
LISTBOXWIDTH,
MainWindow.ClientRect.bottom - MainWindow.ToolbarHeight - PROPERTYHEIGHT,
WindowHandle,
(HMENU)ID_LISTBOX,
MainWindow.Instance,
NULL);


...checked that the result is okay, and all is well.

What i want is to do something when the user selects an item in the listbox, BUT the LBN_SELCHANGE never arrives!?!?!?
It's really weird, well to me it is.

In my parent window's windowprocedure, in response to a WM_COMMAND message, i have the following code:
switch(LOWORD(WParam))
{
case ID_LISTBOX:
{
switch (HIWORD(WParam))
{
case LBN_SELCHANGE:
MessageBox(MainWindow.Handle, "OMG!!! SELCHANGE!!!!!! w000000t!!", "ok", MB_OK);
return 0; default:
int test = HIWORD(WParam);
if (test != 4 && test != 5)
MessageBox(MainWindow.Handle, "Some other event.", "!", MB_OK);
return 0;
}
}
}

What's REALLY weird is that i get LBN_DBLCLICK but NEVER LBN_SELCHANGE.

What the f*** am i doing wrong here!?!

ReneG
January 27th, 2004, 02:56 AM
Solved it. The problem was in a switch statement just before the one i pasted. Stupid me... :)