CMFCAcceleratorKeyAssignCtrl Class
The CMFCAcceleratorKeyAssignCtrl
class extends the CEdit Class to support extra system buttons such as ALT, CONTROL, and SHIFT.
class CMFCAcceleratorKeyAssignCtrl : public CEdit
Name | Description |
---|---|
CMFCAcceleratorKeyAssignCtrl::CMFCAcceleratorKeyAssignCtrl | Constructs a CMFCAcceleratorKeyAssignCtrl object. |
Name | Description |
---|---|
CMFCAcceleratorKeyAssignCtrl::GetAccel | Retrieves the ACCEL structure for a shortcut key pressed in the CMFCAcceleratorKeyAssignCtrl object. |
CMFCAcceleratorKeyAssignCtrl::IsFocused | |
CMFCAcceleratorKeyAssignCtrl::IsKeyDefined | Determines whether a shortcut key has been defined. |
CMFCAcceleratorKeyAssignCtrl::PreTranslateMessage | Used by class CWinApp to translate window messages before they are dispatched to the TranslateMessage and DispatchMessage Windows functions. (Overrides CWnd::PreTranslateMessage.) |
CMFCAcceleratorKeyAssignCtrl::ResetKey | Resets the shortcut key. |
This class extends the functionality of the CEdit
class by supporting shortcut keys, also known as accelerator keys. The CMFCAcceleratorKeyAssignCtrl
class functions as a CEdit Class and it can also recognize system buttons.
This class maps physical shortcut key combinations to string values. For example, assume the key combination ALT + B is mapped to the string "Alt + B". When the user presses this key combination in a CMFCAcceleratorKeyAssignCtrl
object, "Alt + B" is displayed to the user. For more information about the mapping between shortcut keys and a string format, see CMFCAcceleratorKey Class.
The following example demonstrates how to construct a CMFCAcceleratorKeyAssignCtrl
object and use its ResetKey
method to reset the shortcut key.
CMFCAcceleratorKeyAssignCtrl *accelCtrl = new CMFCAcceleratorKeyAssignCtrl();
accelCtrl->ResetKey();
CMFCAcceleratorKeyAssignCtrl
Header: afxacceleratorkeyassignctrl.h
Constructs a CMFCAcceleratorKeyAssignCtrl object.
CMFCAcceleratorKeyAssignCtrl();
Retrieves the ACCEL
structure for a shortcut key pressed in the CMFCAcceleratorKeyAssignCtrl object.
ACCEL const* GetAccel() const;
An ACCEL
structure that describes the shortcut key.
Use this function to retrieve the ACCEL
structure for a shortcut key that the user entered into your CMFCAcceleratorKeyAssignCtrl
object.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
BOOL IsFocused() const;
Determines whether a shortcut key has been defined in the CMFCAcceleratorKeyAssignCtrl object.
BOOL IsKeyDefined() const;
Nonzero if the user has already pressed a valid combination of keys that define a shortcut key; otherwise 0.
Use this function to determine whether the user entered a valid shortcut key in your CMFCAcceleratorKeyAssignCtrl
object. If a shortcut key exists, you can use CMFCAcceleratorKeyAssignCtrl::GetAccel method to obtain the ACCEL
structure associated with this shortcut key.
For more detail see the source code located in the VC\atlmfc\src\mfc folder of your Visual Studio installation.
virtual BOOL PreTranslateMessage(MSG* pMsg);
[in] pMsg
Resets the shortcut key.
void ResetKey();
The function clears the edit control text. This includes any shortcut keys that the user pressed.