Control.processCmdKey

Overview | Methods | Fields | This Package | All Packages

Control.processCmdKey

Processes a command key.

Syntax

protected boolean processCmdKey( MSG msg, int keyData )

Parameters

msg

The message to process. Possible values for the message field of the msg parameter are WM_KEYDOWN, WM_SYSKEYDOWN, WM_CHAR, and WM_SYSCHAR.

keyData

An integer that specifies the key code for the key the user pressed and indicates which, if any, of the CTRL, SHIFT, and ALT keys were pressed at the time.

Return Value

Returns true if the method processes the command key; returns false if the key that was pressed is not a command key.  

Remarks

Command keys are keys that take precedence over regular input keys. Examples of command keys are shortcut keys and access keys. If this control has a shortcut menu (also known as a context menu), this method calls the processCmdKey method of the ContextMenu object that represents the shortcut menu to check for menu shortcuts. Finally, if the control has a parent, the key is passed to the parent's processCmdKey method. In this way, command keys are "bubbled" up the control hierarchy.

When overriding the processCmdKey method, a control should return true to indicate that it has processed the key. For keys that aren't processed by the control, the control should return the result of the super.processCmdKey method.