Originally published in Rebol Forces.

Author: Allen Kamp
Date: June, 2001
Purpose: A collection of hints, tips and wisdom from
the Rebol Ally list



Q. How do I access the clipboard ?

A. The Field and Area elements of VID respond to the keyboard shortcuts of

Ctrl X - Cut
Ctrl C - Copy
Ctrl V - Paste

But you can also manually read or write from/to the clipboard.

To paste text to the clipboard

write clipboard:// "Hello World"

To copy from the clipboard

read clipboard://
== "Hello World"

Q. How do I launch my web browser in Kiosk mode?

A. Use -k. This is known to work for IE, other browers may have similar flags

browse "-k http://www.rebol.com"

use Alt-F4 to close.


Q. How do I set the check value?

A. VID is extremely flexible, here are some different ways.

  • Using 'with
view layout [chk1: check with [data: true]
  • Using a boolean value to set it during creation
view layout [
check on check off
check true check false
check yes check no
  • Using a style
checkers: stylize [
true-check: check with [data: true]
view layout [styles checkers
chk1: true-check chk2: check]
  • Using 'do inside a layout to set the value
view layout [chk1: check do [chk1/data: true]]
  • Create the layout and set the value of the checkbox before showing it
checks: layout [chk1: check chk2: check]
chk1/data: true
view checks
  • Change from a button action
view layout [chk1: check on button "Change" [chk1/data: not chk1/data show chk1]]

Q. How can I find out the value of a checkbox?

A. The current value of the checkbox is stored in face/data

view layout [
txt: text "" 60x26
chk1: check
button "State?" [txt/text: form chk1/data show txt]
do [txt/text: form chk1/data show txt] ; set txt to chk1 starting state

Q. How do I change the title bar text?

A. Currently the window face has to be unviewed and reviewed to make a change.

view/title me: layout [size 300x100
button "change title" [unview/all view/title me "after" ]
] "before"


view/title me: layout [size 300x100
button "change title" [unview/all me/text: "after" view me]
] "before"

Q. How can I highlight text in a face?

A. The field can now does this automatically. But if you want to do it manually, this function sets focus to the face and highlights the text, so it will be cleared with users first keystroke.

highlight-text: func [face][
focus face
system/view/highlight-start: head face/text
system/view/highlight-end: tail face/text
system/view/caret: head face/text
view layout [name: field "<enter your name>" do [highlight-text name]]

Q. Where can I find the source for VID?

A. You can probe system/view/vid to see the VID source code to get a good idea for how it works.  This is helpful if you are thinking about creating your own interface dialect for specific purposes, or have found some problem with VID that you need to patch.  For a current print out, type the following in the console

>> save %view.txt system/view

(For VID history buffs only: a very old version can be found here <A HREF="http://www.rebol.com/view/vid.r"vid.r</A>)

Q. How can I modify LIST faces dynamically?

Use a supply function to modify the face dynamically. Here is an example that will list the files of a directory, and color-code the directories, scripts and other files.

files: read %.
view layout [
list 240x400 [
text 240x16 font [size: 12 color: black shadow: none]
] supply [
face/text: either count > length? files [""][pick files count]
either dir? to-file face/text [
set-font face 'color blue
either %.r = find/last face/text %. [
set-font face 'color red
set-font face 'color black


Q. Where can I find the screen size?

A. The screen-size is in the top level face object


Note this is the resolution screen size pair and not the usable area, so you should account for things such as taskbars.

Q. Where can I find my main window face?

A. Open windows are stored in the screen-face object.

So if you have one window open you can reference it by

main-face: system/view/screen-face/pane/1

Q. How can I trap the 'close window event?

A. There are a number of events that occur only at the screen-face level.

('close, 'resize, 'active and 'inactive) You can create a function to handle the desired event and insert it into system/view/screen-face/feel/event-funcs using 'insert-event-func.

This example traps the 'close window event and asks the user if they want to quit.

;--create the event handler
evt-close: func [face event][
either event/type = 'close [
inform layout [
Text "Do you want to Quit?" across
Button "Yes" 52x26 [quit] Button "No" 52x26 [hide-popup]
; allow other events to pass through
; insert the handler
insert-event-func :evt-close
; show the screen
view layout [size 150x100 text "Try to close this window"]

Q. How can I see what key events are generated?

A. Here is a script that shows you key press events.

key-event: func [face event] [
if event/type = 'key [
print rejoin [
either event/control ["CTRL-"][""]
either event/shift ["SHIFT-"][""]
mold event/key
insert-event-func :key-event
view layout [text
{Type and see the char or keycode printed in console}
button "Remove Event & Close" 200 [remove-event-func :key-event unview/all]


Be specific with show

If you make a change to a sub-face, use 'show for that sub-face rather than using 'show on the parent face. This reduces redundant refreshes.

Take Care with shortcut keys

Shortcut keys are handy and an easy way to enhance the usability of an interface. But a few things to remember.

  1. Currently shortcuts are not specific to an element. So you can't use the same key for more than one item in a layout. Only the first declared will get the event.
  2. Beware of using common text editing keys (delete backspace) for file deletion shortcuts, if the same face also contains 'field or 'area elements.
  3. There are events that the user may trigger while other actions are happening, for example mouse dragging. You may have to add checking to prevent possible action clashing.
  4. If creating more complicated composite styles. The following tests help show any potential problems with binding or contexts.
  • Test with multiple styles in the same layout - to make sure they aren't all using the same words/context.
  • Test with a number of other master VID styles - to see if there is any clashing.
  • Test in a subpane - some binding bugs appear when a style is added at a depth.

Thanks to all who give their time to answer or to pose questions on the list.

For ammendments / contributions please send to