Script Library: 1238 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

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.

 >>do %button-key.r

or to execute this right out of the library


When running, tapping the q on the keyboard will activate the button which has an action block of

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.

4. Credits

  • %button-key.r original author: Unknown
  • Usage document by Brian Tiffin, Library Team Apprentice, Last updated: 28-Apr-2007