I have dialog box with two controls: tree view and list box. I also have message handler for my dialog box.
case WM_NOTIFY:
{
switch(LOWORD(wParam))
{
case IDC_LIST1: //we NEVER comes here
if(((LPNMHDR)lParam)->code == NM_CLICK)
{
//do some work;
return (INT_PTR)TRUE;
}
break;
case IDC_TREE1:
if(((LPNMHDR)lParam)->code == NM_DBLCLK)
{
//do some work;
return (INT_PTR)TRUE;
}
break;
}
}
break;
So, I can't understand why notifications from tree box comes succesfully, but notifications from list box never comes, despite the fact that in the properties of list box' control Notify value is set TRUE. Thank you.
Let's check the documentation.
List Box Styles:
LBS_NOTIFY
Causes the list box to send a notification code to the parent window whenever the user clicks a list box item (LBN_SELCHANGE), double-clicks an item (LBN_DBLCLK), or cancels the selection (LBN_SELCANCEL).
LBN_SELCHANGE:
Notifies the application that the selection in a list box has changed as a result of user input. The parent window of the list box receives this notification code through the WM_COMMAND message.
LBN_DBLCLK:
Notifies the application that the user has double-clicked an item in a list box. The parent window of the list box receives this notification code through the WM_COMMAND message.
LBN_SELCANCEL:
Notifies the application that the user has canceled the selection in a list box. The parent window of the list box receives this notification code through the WM_COMMAND message.
Conclusion: List boxes use WM_COMMAND
to notify the parent, not WM_NOTIFY
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With