<< Return to Main Index

< Return to Class Index

CGXControl::KeyPressed

virtual BOOL KeyPressed(UINT nMessage, UINT nChar, UINT nRepCnt = 1, UINT flags = 0);

nMessage

Specifies the message. This can be WM_KEYDOWN, WM_CHAR or WM_SYSKEYDOWN.

nChar

Specifies the virtual-key code of the given key.

nRepCnt

Repeat count (the number of times the keystroke is repeated as a result of the user holding down the key).

flags

Specifies the scan code, key-transition code, previous key state, and context code, as shown in CWnd::OnKeyDown.

Return Value

TRUE if the key has been processed; FALSE otherwise.

Remarks

Called when the user has pressed a key and the active-flag is FALSE (the grid-parent has the focus).

When KeyPressed is called for a CGXEditControl (not read-only) with an alphanumeric key, the cell’s content will be erased and the character inserted. Other keys like HOME or END position the caret to the first or last position of the text. In both cases, the focus is passed to the CEdit associated with the control.

When KeyPressed is called for a CGXPushbutton and nChar is blank, OnClickedButton will be called.

The base-class version of this command calls the KeyPressed method of the focused CGXChild, if any.

See Also

CGXGridCore::ProcessKeys CGXControl::OnClickedButton CGXChild::KeyPressed

CGXControl

Class Overview | Class Members