Wt
4.11.1
|
A class providing details for a keyboard event. More...
#include <Wt/WEvent.h>
Public Member Functions | |
WKeyEvent () | |
Default constructor. | |
Key | key () const |
Returns the key code key that was pressed or released. More... | |
WFlags< KeyboardModifier > | modifiers () const |
Returns keyboard modifiers. More... | |
int | charCode () const |
Returns the unicode character code. More... | |
WString | text () const |
The (unicode) text that this key generated. More... | |
A class providing details for a keyboard event.
A key event is associated with the WInteractWidget::keyWentDown(), WInteractWidget::keyWentUp() and WInteractWidget::keyPressed() signals.
int Wt::WKeyEvent::charCode | ( | ) | const |
Returns the unicode character code.
This is only defined for a keyPressed event, and returns the unicode character code point of a character that is entered.
For the keyWentDown and keyWentUp events, '0' is returned.
The charCode() may be different from key(). For example, a Key::M key may correspond to 'm' or 'M' character, depending on whether the shift key is pressed simultaneously.
Key Wt::WKeyEvent::key | ( | ) | const |
Returns the key code key that was pressed or released.
The key code corresponds to the actual key on the keyboard, rather than the generated character.
All three types of key events provide this information.
WFlags<KeyboardModifier> Wt::WKeyEvent::modifiers | ( | ) | const |
Returns keyboard modifiers.
The result is a logical OR of KeyboardModifier flags.
All three types of key events provide this information.
WString Wt::WKeyEvent::text | ( | ) | const |
The (unicode) text that this key generated.
This is only defined for a keyPressed event, and returns a string that holds exactly one unicode character, which corresponds to charCode().
For the keyWentDown and keyWentUp events, an empty string is returned.