## wxKeyEvent

This event class contains information about keypress (character) events.

Derived from

wxEvent

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.

See also

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

### wxKeyEvent::m_altDown

bool m_altDown

TRUE if the Alt key is pressed down.

### wxKeyEvent::m_controlDown

bool m_controlDown

TRUE if control is pressed down.

### wxKeyEvent::m_keyCode

long m_keyCode

Virtual keycode. See Keycodes for a list of identifiers.

### wxKeyEvent::m_metaDown

bool m_metaDown

TRUE if the Meta key is pressed down.

### wxKeyEvent::m_shiftDown

bool m_shiftDown

TRUE if shift is pressed down.

### wxKeyEvent::m_x

int m_x

X position of the event.

### wxKeyEvent::m_y

int m_y

Y position of the event.

### wxKeyEvent::wxKeyEvent

wxKeyEvent(WXTYPE keyEventType)

Constructor. Currently, the only valid event types are wxEVT_CHAR and wxEVT_CHAR_HOOK.

### wxKeyEvent::AltDown

bool AltDown() const

Returns TRUE if the Alt key was down at the time of the key event.

### wxKeyEvent::ControlDown

bool ControlDown() const

Returns TRUE if the control key was down at the time of the key event.

### wxKeyEvent::GetKeyCode

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.

### wxKeyEvent::GetX

long GetX() const

Returns the X position of the event.

### wxKeyEvent::GetY

long GetY() const

Returns the Y position of the event.

### wxKeyEvent::MetaDown

bool MetaDown() const

Returns TRUE if the Meta key was down at the time of the key event.

### wxKeyEvent::GetPosition

wxPoint GetPosition() const

void GetPosition(long *x, long *y) const

Obtains the position at which the key was pressed.

### wxKeyEvent::HasModifiers

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.

### wxKeyEvent::ShiftDown

bool ShiftDown() const

Returns TRUE if the shift key was down at the time of the key event.