glgui event - part-cw/lambdanative GitHub Wiki
(glgui-event guis t x0 y0)
glgui-event process an input event. It loops over all guis provided and sends events to their widgets's input handlers. It is mainly found in the second function (the loop) of the main program declaration.
| Parameter | Description |
|---|---|
| g | Graphical User Interface (GUI) or a list of GUIs |
| t | Event type, e.g. EVENT_KEYPRESS |
| x0 | First argument of event, e.g. x coordinate pixels or keyboard character |
| y0 | Second argument of event, e.g. y coordinate in pixels or modifier flags |
If t is an EVENT_KEYPRESS or EVENT_KEYRELEASE event, y0 will have its bits set according to the modifier keys that are on, as described below.
| Modifier key(s) | Constant name(s) | Constant value | Corresponding bit, where the rightmost bit is the zeroth bit |
|---|---|---|---|
| Control (macOS) | MODIFIER_CTRL_MAC | 1 | 0 |
| Control (Windows)/Command (macOS) | MODIFIER_CTRL/MODIFIER_CMD | 2 | 1 |
| Alt (Windows)/Option (macOS) | MODIFIER_ALT/MODIFIER_OPT | 4 | 2 |
| Shift | MODIFIER_SHIFT | 8 | 3 |
| Caps Lock | MODIFIER_CAPS | 16 | 4 |
| Function | MODIFIER_FN | 32 | 5 |
Example
Example from apps/DemoRedSquare/main.scm
(lambda (t x y)
(if (= t EVENT_KEYPRESS) (begin (if (= x EVENT_KEYESCAPE) (terminate))))
(glgui-event gui t x y)
)