I'm using the following code to process a WM_NOTIFY message:
switch(pNotify->code)
{
case NM_DBLCLK:
case NM_RETURN:
SelectProc(Window, lParam);
break;
...
But there never seems to be a NM_RETURN code. Is there a trick to getting
the ENTER key to work?
G.
Is this ListView on a dialog box?
Jeff...
--
Please post all follow-ups to the newsgroup only.
"Genna" <gvj_n...@ttd.ca> wrote in message news:OPr3I6viBHA.1932@tkmsftngp04...
"Genna" <gvj__n...@ttd.ca> wrote in message news:OnMPq$wiBHA.1012@tkmsftngp03...
> The ListView is part of a Dialog Box.
>
Well, here's what I think the deal is: Unless the control with the focus returns DLGC_WANTMESSAGE in
response to the WM_GETDLGCODE message (wherein the LPARAM is not NULL and is an LPMSG who's message
is WM_KEYDOWN and WPARAM is VK_RETURN), the default dialogbox keyboard interface intercepts the
ENTER key and translates it into a WM_COMMAND message with a wParam value equal to IDOK or the id of
the defpushbutton, and sends it to the DlgProc. I don't think there's an LVS_ style to handle this
so... if this is the situation, one solution would be to subclass the ListView, and handle the
WM_GETDLGCODE message appropriately. Another possibility might be to handle the WM_COMMAND situation
and call your selection proc when the listview has the focus. Another possibility might be to use an
accelerator.
HTH,
> But there never seems to be a NM_RETURN code. Is there a trick to getting
> the ENTER key to work?
I've already answered you : copy-paste =>
"Subclass the Listview, then, in the new proc =>
switch (iMsg)
{
case WM_GETDLGCODE :
{
return DLGC_WANTALLKEYS ;
} break;
}
"
"Christian ASTOR" <cast...@club-internet.fr> wrote in message
news:3C24E2BF...@club-internet.fr...
Isn't DLGC_WANTALLKEYS too inclusive -- it'll trap the TAB key as well as the ESC key for example?
How about something like...
switch (iMsg)
{
case WM_GETDLGCODE:
{
LPMSG pMsg = (LPMSG)lParam;
if (pMsg && (pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN))
return DLGC_WANTMESSAGE;
}
break;
.if uMsg == WM_CHAR
.if wParam == 0Dh
return 0
.endif
.endif
.if uMsg == WM_KEYDOWN
.if wParam == 0dh
invoke SetFocus,handle of desired window
the above monitors the wm_keydown message but doesnt process the 0dh
(carrage return code)
and works for me
John Klosak
klo...@qcvascular.com
"Genna" <gvj_n...@ttd.ca> wrote in message
news:OPr3I6viBHA.1932@tkmsftngp04...