Capturing 'Enter' key
-
When I have a modeless dialog window opened and I hit enter the dialog will dissapear. I don't want that to happen. If I am editing the data in a control and I hit enter I would like the focus to shift as if I pressed tab. I got the following code from this website but I don't understand it. I can't find WM_GETDLGCODE and on top of that I don't want to create a new class just to capture a message. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } Can someone tell me how to capture 'enter' and shift the focus from one control to another. none
-
When I have a modeless dialog window opened and I hit enter the dialog will dissapear. I don't want that to happen. If I am editing the data in a control and I hit enter I would like the focus to shift as if I pressed tab. I got the following code from this website but I don't understand it. I can't find WM_GETDLGCODE and on top of that I don't want to create a new class just to capture a message. UINT SMUPPGrid::OnGetDlgCode() { UINT result = CListCtrl::OnGetDlgCode(); result = result | DLGC_WANTALLKEYS; return result; } Can someone tell me how to capture 'enter' and shift the focus from one control to another. none
Try overriding
OnOK
. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
Try overriding
OnOK
. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
I don't have an IDC_OK handle to deal with. I have removed that button. How can I override the function when I don't have a handle for it? none
-
I don't have an IDC_OK handle to deal with. I have removed that button. How can I override the function when I don't have a handle for it? none
You can modify how the enter key works by overriding the virtual function PreTranslateMessage()
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
pMsg->wParam = VK_TAB;this will cause all ENTER keys to be treated as TABs Roger Allen Sonork 100.10016 Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003