PDA

View Full Version : Capturing 'Enter' key from CHILD COMBOBOX


tdk_ratboy
04-02-2004, 10:55 AM
Hello, How can I take notice of the 'Enter' key being typed when my ComboBox has the input focus? Can I handle this with WM_CHAR? If so, How? Thank You

Terarin Kerowyn
08-13-2004, 12:19 AM
In order to catch the "Enter" key, and other special keys in a CListCtrl (or any control for that matter) it is necessary to derive your own class and add a handler for the WM_GETDLGCODE message. To allow all special keys to be processed by the control add the following:

UINT SMUPPGrid::OnGetDlgCode()
{
UINT result = CListCtrl::OnGetDlgCode();
result = result | DLGC_WANTALLKEYS;
return result;
}

Other options include (from MSDEV documentation):

DLGC_WANTALLKEYS All keyboard input.
DLGC_WANTARROWS Arrow keys.
DLGC_WANTCHARS WM_CHAR messages.
DLGC_WANTMESSAGE All keyboard input. The application passes this message on to the control.
DLGC_WANTTAB TAB key.
DLGC_BUTTON Button (generic).
DLGC_DEFPUSHBUTTON Default pushbutton.
DLGC_HASSETSEL EM_SETSEL messages.
DLGC_UNDEFPUSHBUTTON No default pushbutton processing. (An application can use this flag with DLGC_BUTTON to indicate that it processes button input but relies on the system for default pushbutton processing.)
DLGC_RADIOBUTTON Radio button.
DLGC_STATIC Static control.