| Event | R Documentation |
Everything that happens in a termr application is an event: key
presses, terminal resizes, focus changes, widgets being mounted, and
messages that widgets send (such as "button.pressed").
Events are delivered to their target widget and, if they bubble, to
each ancestor in turn and finally to the App. Any handler can call
event$stop() to stop propagation.
Event types and their classes:
"key": KeyEvent with fields key, char, ctrl, alt, shift;
"resize": ResizeEvent with width and height;
"paste": PasteEvent with the pasted text (bracketed paste);
"focus" / "blur": FocusEvent / BlurEvent (do not bubble);
"mount" / "unmount": MountEvent / UnmountEvent (do not bubble);
any other name: MessageEvent, created by widget$post_message().
typeEvent type, e.g. "key" or "button.pressed".
senderThe widget that created the event (or NULL).
targetThe widget the event is delivered to first.
currentThe widget currently handling the event.
dataA list of event-specific values.
bubblesIs the event passed on to ancestors?
timeCreation time (seconds, monotonic).
stoppedHas propagation been stopped?
default_preventedWas prevent_default() called?
Event$new()Create an event.
Event$new(type, sender = NULL, data = list(), bubbles = TRUE)
typeEvent type.
senderSending widget.
dataList of values.
bubblesDoes the event bubble?
Event$stop()Stop the event from reaching further handlers.
Event$stop()
Event$prevent_default()Ask the sender not to perform its default behaviour.
Event$prevent_default()
Event$format()One-line description.
Event$format(...)
...Ignored.
Event$print()Print the event.
Event$print(...)
...Ignored.
Event$clone()The objects of this class are cloneable with this method.
Event$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> KeyEvent
keyCanonical key name, e.g. "a", "enter", "ctrl+c".
charThe printable character, or "".
ctrl, alt, shiftModifier flags.
KeyEvent$new()Create a key event.
KeyEvent$new(key, char = NULL)
keyKey name (normalised).
charPrintable character, if any.
KeyEvent$is_printable()Is this a printable character without ctrl/alt?
KeyEvent$is_printable()
KeyEvent$clone()The objects of this class are cloneable with this method.
KeyEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> ResizeEvent
width, heightNew terminal size.
ResizeEvent$new()Create a resize event.
ResizeEvent$new(width, height)
width, heightTerminal size.
ResizeEvent$clone()The objects of this class are cloneable with this method.
ResizeEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> PasteEvent
textThe pasted text, normalised: line breaks are LF, tabs are kept and other control characters are removed.
PasteEvent$new()Create a paste event.
PasteEvent$new(text)
textPasted text.
PasteEvent$clone()The objects of this class are cloneable with this method.
PasteEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> FocusEvent
FocusEvent$new()Create a focus event.
FocusEvent$new(widget)
widgetThe widget that received focus.
FocusEvent$clone()The objects of this class are cloneable with this method.
FocusEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> BlurEvent
BlurEvent$new()Create a blur event.
BlurEvent$new(widget)
widgetThe widget that lost focus.
BlurEvent$clone()The objects of this class are cloneable with this method.
BlurEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> MountEvent
MountEvent$new()Create a mount event.
MountEvent$new(widget)
widgetThe mounted widget.
MountEvent$clone()The objects of this class are cloneable with this method.
MountEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> UnmountEvent
UnmountEvent$new()Create an unmount event.
UnmountEvent$new(widget)
widgetThe removed widget.
UnmountEvent$clone()The objects of this class are cloneable with this method.
UnmountEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> MessageEvent
MessageEvent$new()Create a custom message.
MessageEvent$new(type, sender = NULL, data = list(), bubbles = TRUE)
typeMessage name, e.g. "counter.changed".
senderSending widget.
dataList of values.
bubblesDoes the message bubble?
MessageEvent$clone()The objects of this class are cloneable with this method.
MessageEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Event -> MouseEvent
action"down", "up", "move", "scroll" or "click".
button"left", "middle", "right" or "none".
directionWheel direction for scroll events, else NA.
screen_x, screen_yPointer position on the screen (1-based).
x, yPointer position inside the target widget (1-based, relative to the widget's region).
origin_x, origin_yWhere the button went down (screen
coordinates) for drag.* events, else NA.
shift, ctrl, altModifier flags.
MouseEvent$new()Create a mouse event.
MouseEvent$new( action, screen_x, screen_y, button = "none", direction = NA_character_, shift = FALSE, ctrl = FALSE, alt = FALSE )
actionEvent action.
screen_x, screen_yScreen position.
buttonButton name.
directionWheel direction (scroll events).
shift, ctrl, altModifiers.
MouseEvent$offset_in()The pointer position relative to another widget.
MouseEvent$offset_in(widget)
widgetA widget with a region.
c(x =, y =), 1-based; may be outside the widget.
MouseEvent$clone()The objects of this class are cloneable with this method.
MouseEvent$clone(deep = FALSE)
deepWhether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.