KeyEvent
Table of contents
Represent a keyboard event
type KeyEvent struct {
AltKey bool
Code KeyCode
CtrlKey bool
Key string
MetaKey bool
Repeat bool
ShiftKey bool
TimeStamp uint64
}
Member | Type | Description |
---|---|---|
AltKey | bool |
true if the alt key was down when the event was fired, false otherwise |
Code | KeyCode |
String that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value. |
CtrlKey | bool |
true if the control key was down when the event was fired. false otherwise. |
Key | string |
Key value of the key represented by the event. If the value has a printed representation, this attribute's value is the same as the char property. Otherwise, it's one of the key value strings specified in Key values. If the key can't be identified, its value is the string "Unidentified". |
MetaKey | bool |
true if the meta key was down when the event was fired. false otherwise. |
Repeat | bool |
true if a key has been depressed long enough to trigger key repetition, otherwise false. |
ShiftKey | bool |
true if the shift key was down when the event was fired. false otherwise. |
TimeStamp | uint64 |
Time at which the event was created (in milliseconds). This value is time since epoch—but in reality, browsers' definitions vary. |
Related global functions
func GetKeyDownListeners(view View, subviewID ...string) []func(View, KeyEvent)
Returns the "key-down-event" listener list. If there are no listeners then the empty list is returned. If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned
func GetKeyUpListeners(view View, subviewID ...string) []func(View, KeyEvent)
Returns the "key-up-event" listener list. If there are no listeners then the empty list is returned. If the second argument (subviewID) is not specified or is an empty string then a value from the first argument (view) is returned