This event class contains information about keypress (character) events.
Derived from
Include files
<wx/event.h>
Event table macros
To process a key event, use these event handler macros to direct input to member functions that take a wxKeyEvent argument.
EVT_CHAR(func) | Process a wxEVT_CHAR event (a non-modifier key has been pressed). |
EVT_KEY_DOWN(func) | Process a wxEVT_KEY_DOWN event (any key has been pressed). |
EVT_KEY_UP(func) | Process a wxEVT_KEY_UP event (any key has been released). |
EVT_CHAR(func) | Process a wxEVT_CHAR event. |
EVT_CHAR_HOOK(func) | Process a wxEVT_CHAR_HOOK event. |
wxWindow::OnChar, wxWindow::OnCharHook, wxWindow::OnKeyDown, wxWindow::OnKeyUp
Members
wxKeyEvent::m_altDown
wxKeyEvent::m_controlDown
wxKeyEvent::m_keyCode
wxKeyEvent::m_metaDown
wxKeyEvent::m_shiftDown
wxKeyEvent::m_x
wxKeyEvent::m_y
wxKeyEvent::wxKeyEvent
wxKeyEvent::AltDown
wxKeyEvent::ControlDown
wxKeyEvent::GetKeyCode
wxKeyEvent::GetX
wxKeyEvent::GetY
wxKeyEvent::MetaDown
wxKeyEvent::GetPosition
wxKeyEvent::HasModifiers
wxKeyEvent::ShiftDown
bool m_altDown
TRUE if the Alt key is pressed down.
bool m_controlDown
TRUE if control is pressed down.
long m_keyCode
Virtual keycode. See Keycodes for a list of identifiers.
bool m_metaDown
TRUE if the Meta key is pressed down.
bool m_shiftDown
TRUE if shift is pressed down.
int m_x
X position of the event.
int m_y
Y position of the event.
wxKeyEvent(WXTYPE keyEventType)
Constructor. Currently, the only valid event types are wxEVT_CHAR and wxEVT_CHAR_HOOK.
bool AltDown() const
Returns TRUE if the Alt key was down at the time of the key event.
bool ControlDown() const
Returns TRUE if the control key was down at the time of the key event.
int GetKeyCode() const
Returns the virtual key code. ASCII events return normal ASCII values, while non-ASCII events return values such as WXK_LEFT for the left cursor key. See Keycodes for a full list of the virtual key codes.
long GetX() const
Returns the X position of the event.
long GetY() const
Returns the Y position of the event.
bool MetaDown() const
Returns TRUE if the Meta key was down at the time of the key event.
wxPoint GetPosition() const
void GetPosition(long *x, long *y) const
Obtains the position at which the key was pressed.
bool HasModifiers() const
Returns TRUE if either of CTRL, ALT or META keys was down at the time of the key event. Note that this function does not take into account the SHIFT key state.
bool ShiftDown() const
Returns TRUE if the shift key was down at the time of the key event.