|View script||License||Download documentation as: HTML or editable||Download script||History|
Script Library: 1219 scripts
Documentation for: button-key.r
Usage document for %button-key.r
1. Introduction to %button-key.r
This library script shows how easy it is to add key bindings to VID face styles (see below for term explanations), in particular, buttons.
2. Using %button-key.r
Using this script is simple. Just DO it.
or to execute this right out of the rebol.org library
When running, tapping the q on the keyboard will activate the button which has an action block of
[quit]and the script will quit.
3. What you can learn
3.1. Face Style
Face style is a REBOL term that you may have heard referred to as 'widget' or 'graphical element'. REBOL programmers may use just the word face, or just style when talking about 'window gadgets'. Modifiers are termed 'facets'.
Reading the REBOL/View Developer's Guide will explain the preferred terms used for REBOL graphical programming.
3.2. Datatype char!
This sample script, uses #"q", to specify the character q. REBOL programmers use this character quite a bit, and it consistently means quit. If you wanted this key binding to be Ctrl-Q it would be specified as #"^Q" char! spec.
3.3. View facets
Looking through this script, you'll see how easy it is to bind a key to a face. Just name an char! datatype after the face style and if possible it will be used as the keyboard shortcut binding for that face. As with most VID facets, the char! is optional. REBOL does not use any default bindings for any particular face. Some keys like Tab, Enter, Backspace are active in most input faces, and for travelling around the screen faces.