GIR Events {gir} | R Documentation |
These functions allow R code to receive and respond to UI events.
girProcessEvents() girSetHandler(event.id, handler.func, window.index = 0) girRemoveHandler(event.id, window.index = 0) girClearEvents(window.index = 0) girTime() handlerFunction(window.index, event.id, arg1, arg2, time)
window.index |
vector of integers; containing the indices (or index) of windows on which to operate. An index of 0 specifies the current window. For the handler function, the index of the window that received the event. |
event.id |
vector of integers; specifying the events(s) to set or remove handlers for; should consist of value(s) from the table below. For the handler function, an integer specifying what event caused the function to be called. |
handler.func |
the function to assign to handle the specified event for the specified window(s). One function may be assigned to handle many events. The function must have arguments as specified above. They are not named, so be sure their order is correct. |
arg1, arg2 |
General-purpose arguments to the handler function. Described below. |
time |
The time the event was received, in milliseconds from some arbitrary origin. See girTime . |
GIR has a simple event system that allows your code to receive and respond to events generated by the user or the windowing system.
Each window maintains an event queue. If a window is set to receive events, they will be added (asynchronously) to the queue by GIR.
To instruct a window to receive events, create it with a doevents
argument of TRUE
, or
call girSetDoEvents
with a doevents
argument of TRUE
.
girSetDoEvents
may be called at any time with a doevents
argument of FALSE
to instruct the window to ignore subsequent events.
girSetHandler
and girRemoveHandler
assign and remove the handler function for specified
event(s) on specified window(s). handler.id specifies which event(s) the function should handle, and should
be a value from the Events
table below.
girSetHandler
and girRemoveHandler
return the handler function(s) which were replaced
or removed (or NULL if there wasn't one for the corresponding window).
girTime
returns the time in milliseconds from some arbitrary origin; guaranteed to be comparable
to the time value received by a handler function. FIXME: this may wrap around.
All other functions return NULL
, and are invoked for their side effects.
EVENT_CLOSE
EVENT_SIZE
EVENT_GAIN_FOCUS, EVENT_LOSE_FOCUS
EVENT_REPAINT
EVENT_MOUSE_MOVE
EVENT_MOUSE_LBUTTON_UP,EVENT_MOUSE_LBUTTON_DOWN
EVENT_MOUSE_MBUTTON_UP,EVENT_MOUSE_MBUTTON_DOWN
EVENT_MOUSE_RBUTTON_UP,EVENT_MOUSE_RBUTTON_DOWN
EVENT_MOUSE_WHEEL_UP,EVENT_MOUSE_WHEEL_DOWN
EVENT_KEY_UP,EVENT_KEY_DOWN
GIR_KEY_*
in gir.r.
girSetDoEvents
, girCreateWindow
, GIR_KEY