Widgets

Widgets are grouped in a single context named widgets. In the following descriptions each widget is described along with its common specification attributes (other than offset, size and span) and subsequent runtime accessors (attributes commonly used to change its appearance prior to show and/or referenced to determine its state).

RebGUI Beta 2 includes changes and enhancements to many of these widgets. Widgets marked with a single star after their name (*) have yet to be fully reviewed but are included in the base distribution. Widgets marked with a double star (**) need more work and are not included in the base distribution. Those marked with a triple star (***) are currently under development.

Table of Contents

  1. anim
  2. area*
  3. arrow
  4. bar
  5. box
  6. button
  7. calendar
  8. chart**
  9. check
  10. chat*
  11. check-group
  12. drop-list*
  13. drop-tree**
  14. edit-list*
  15. field
  16. grid**
  17. group-box
  18. icon***
  19. image
  20. input-grid**
  21. label
  22. led
  23. led-group
  24. link
  25. menu
  26. panel
  27. password
  28. pie-chart*
  29. progress
  30. radio-group
  31. slider*
  32. spinner
  33. splitter
  34. symbol
  35. table*
  36. tab-panel
  37. text
  38. text-list*
  39. title-group
  40. tool-bar
  41. tooltip

anim

Cycles a set of images.

anim data [%images/go-previous.png %images/go-next.png]
anim data [image-1 image-2] rate 2
AttributeNote
datablock of file and/or image to cycle
rateinteger or time that controls the cycle (default 1)

source:widgets/anim.r

area*

Editable text area with text wrapping.

area
AttributeNote
textstring to display
options[info] specifies read-only

source:widgets/area.r

arrow

An arrow on a square face.

arrow
arrow data 'up
arrow data 'down
arrow data 'left
arrow data 'right
AttributeNote
dataword specifying arrow orientation (default 'down)

source:widgets/arrow.r

bar

A thin 3D bar used to separate widgets.

bar
bar 200

source:widgets/bar.r

box

The most basic of widgets, a rectangular area.

box red

source:widgets/box.r

button

Performs action when clicked.

button "Click me!" [print "Left"] [print "Right"]
AttributeNote
textstring to display
options[info] specifies read-only

source:widgets/button.r

calendar

Used to select a date.

calendar
calendar data 1-Jan-2000
AttributeNote
datadate indicating current selection (default now/date)

source:widgets/calendar.r

chart**

New widget.

chart ???

source:widgets/chart.r

check

A tristate check-box with a green tick representing YES, a red cross NO, and empty being UNKNOWN. Left and right mouse clicks alternate between Yes/No and Unknown respectively.

check "Option"
check "Option" data true
check "Option" data false
check "Option" options [info]
AttributeNote
textstring to appear to the right of the check-box
datalogic that indicates state of control (yes, no or unknown)
options[info] specifies read-only

source:widgets/check.r

chat*

A 3-column multi-line scrollable widget similar to that found in AltME and designed for IM/chat applications.

chat data [
    "Bob" none "Comment." yello 1-May-2007/10:00:00
]
AttributeNote
datablock of user/color/comment/color/date entries
options[limit n] limits message display to n entries
options[id n] set width of ID column
options[user n] set width of USER column
options[date n] set width of DATE column

check-group

A group of check boxes. Alignment is vertical unless height is specified as line height (5 units).

check-group data [
    "Option-1" true
    "Option-2" false
    "Option-3" none
]
AttributeNote
datablock of label/state pairs (string & logic) specifying one or more check boxes
options[info] specifies read-only
Runtime
datablock of logic (or none) indicating state of each check box

source:widgets/check-group.r

drop-list*

A single column selection list. Fires action only if a selection was made.

drop-list data ctx-rebgui/locale*/colors
AttributeNote
textstring to display
datablock of values to appear in list
Runtime
textstring representing current selection

source:widgets/drop-list.r

drop-tree**

This widget is a combination of a menu and drop-down list that containes a tree. The idea is to use it as a very space optimized and fast menu system. If there is no action associated with a node and the node doesn't has any subnodes the node is grayed out.

- Supports fast-selection buttons to expand the tree to level 1-4 directly. Buttons give visual feedback.
- The tree lines are highlighted when the mouse moves over them.
- Expanding a node doesn't executed an ACTION block, only if the text is clicked on.
- Nodes expand only if the action block returns TRUE (in the same line like the on-un/focus triggers).
- The tree list is position automatically so that the selected node is the 2nd line from the top after a user selection to speed up useability.
- The selected path is shown in the field of the drop-tree giving you a visual feedback where you are.
- Supports alt-action block which can be used for the default code when node without ACTION block is selected.

drop-tree 100 data [
   "Node1" [
       "Node1-1" action [<code to execute if NODE1-1 clicked by user>]
       "Node1-2"
       "node1-3"
   ] action [<code to execute if NODE1 clicked by user>]
   "Node2" [
   ]
   "Node3"
   "Node4"
][print "Global action called!"][print "default 'EMPTY ACTION' block"]
AttributeNote
datanested block of nodes and actions to appear in tree
Runtime
expander-mode'big (default) or 'small. When 'big the fast-selection buttons are left-to-right. When 'small the fast-selection buttons have quater size.
popup-mode'inside (default) or 'outside, see drop-list
select-node [string!]The string contains the path to the item you want to select in positional notation. Example: "1/2/1"
updateRequired after SELECT-NODE or flag changes
textThe selection-path text
hide-treeCloses the drop-list of the drop-tree

source:widgets/drop-tree.r

edit-list*

An editable single column selection list.

edit-list data ctx-rebgui/locale*/colors
AttributeNote
textstring to display
datablock of values to appear in list
Runtime
textstring representing current selection

source:widgets/edit-list.r

field

Editable text field with no text wrapping.

field "String"
AttributeNote
textstring to display
options[info] specifies read-only

source:widgets/field.r

grid**

New widget.

grid ???

source:widgets/grid.r

group-box

A static widget used to group widgets within a bounded container.

group-box "Sample" data [
    field field
]
AttributeNote
textstring title
datablock of sub-widgets

source:widgets/group-box.r

icon***

Similar to image, but SVG-based.

image

An image.

image %images/logo.png
image logo
AttributeNote
imagefile or image to render
effectword or block of effects to apply to the image (default 'fit)

source:widgets/image.r

input-grid**

A widget that can be used to get input from the user in a grid-form.
- supports headers for the different columns
- supports descriptions for the different rows (on the left side)
- counting starts at 1x1 for the non-header cells, header/description cells have index 0x... and ...x0
- columns can have different types like FIELD, LABEL
- each cell should be accessible through a PAIR key: input-grid/2x3 (like the image! datatype)
- optional auto cell-naming function to give every cell a unique, but pattern based name that can be used as word within the code

  • generated words are automatically added to the widget context

- Supports save/load input-grid data from/to the grid
- Supports default values either by column or by row

demo-values: copy []

repeat n 4 * 8 [
    insert demo-values form (random 100) / 10
]

display "test" [
    ig: input-grid data [
        row-title "1st Columns"
        columns ["Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday" label "Sums"]
        rows ["1st Shift" "2nd Shift" "3rd Shift"]
        values demo-values
        auto-cell-naming
        row-names [monday tuesday wensday thursday friday saturday sunday sum]
        column-names [a b c]
        name-divider "-"
        cell-action [
            print ["cell action:" face/offset value]
        ]
    ] [print "input grid global action"]
]

DATA block specification dialect:
You have to specify all options in DATA block. The DATA block can contain:

KeywordTypeDescription
row-titlestring!This is the text in cell 0x0 with optional text align (center | left | right)
columnsblock! or word!block of the column header texts and column types(optional) and column widths(optional) text align center | left | right (optional). For example [label "column1" field "column2" 50] etc. If you don't specify the type it will use default FIELD type. If you don't specify the column width the default value of 22 units is used.
rowsblock! or word!block of rows description texts and text align (center | left | right - optional)
valuesblock! or word!block of text values for all cells in the grid
auto-cell-naminggenerates a context with words bounds to each cell. The word pattern is 'cell11 'cell12 'cell13 etc.
row-namesblock!specifies name part which is used for construction of cell names
column-namesblock!specifies name part which is used for construction of cell names
name-dividerstring!specifies part which is used for division of row-names and column-names parts
cell-actionblock!specifies code which is called when user presses enter key in any of the cell in grid


Widget accessors:

Function nameParametersDescription
SET-CELLpair! string!using this method you can set any cell in the grid. Example: my-grid/set-cell 1x1 "test"
GET-CELLpair!using this method you can get any cell in the grid. Example: my-grid/get-cell 1x1 result = "test"
SET-GRIDblock!using this method you can set the content of grid cells providing block of string values per each cell.
GET-GRID-using this method you can get the content of grid cells. It returns block of string values per each cell.
MAKE-CELL-NAMESrow-names column-names name-dividerthis method will create my-grid/ctx-cells context which contains generated words refering to each cell. (this is invoked also when you specify auto-cell-naming keyword in the DATA block). The word pattern is generated using the row-names + divider + column-names etc. so you can access the cells like: my-grid/make-cell-names [team lead] [name city] "_" show-text my-grid/ctx-cells/team_name "New text" or do bind [probe lead_city/text] in my-grid/ctx-cells 'self
GET-CELL-NAMES-returns a block of cell words ('cell11 'cell12 'cell13 etc.) which are bound to each cell in the grid. So you can do for example: cell-names: my-grid/get-cell-names cell-names/1==cell11 show-text get cell-names/1 "Test"

source:widgets/input-grid.r

label

Bold text.

label "A text label."
AttributeNote
textstring to display

source:widgets/text.r

led

A tristate indicator box with a dark fill representing YES, a light fill NO, and empty being UNKNOWN.

led "Option"
led "Option" data true
led "Option" data false
led "Option" data none
AttributeNote
textstring to appear to the right of the LED indicator
datalogic that indicates state of control (yes, no or unknown)

source:widgets/led.r

led-group

A group of LED indicators. Alignment is vertical unless height is specified as line height (5 units).

led-group data [
    "Option-1" true
    "Option-2" false
    "Option-3" none
]
AttributeNote
datablock of label/state pairs (string and logic) specifying one or more LED indicators
Runtime
datablock of logic indicating state of each LED indicator

source:widgets/led-group.r

Hypertext widget.

link
link "www.dobeash.com"
link "http://www.dobeash.com"
AttributeNote
textstring domain name or URL (default "www.rebol.com")

source:widgets/link.r

Simple one-level text-only menu system.

menu data [
    "Item-1" [
        "Choice 1" [print "1"]
        "Choice 2" [print "2"]
    ]
    "Item-2" []
    "Item-3" []
]
AttributeNote
datablock of string/block (spec) pairs further containing string/block action pairs

source:widgets/menu.r

panel

A static widget used to group widgets within a container.

panel sky data [
    after 1
    field
    field
    field
]
AttributeNote
datablock of sub-widgets

source:widgets/panel.r

password

Editable password field with text displayed as a series of large dots.

password
password "Secret"
AttributeNote
textstring to store

source:widgets/password.r

pie-chart*

A pie-chart.

pie-chart data [
    "Red" red 60
    "Green" green 30
    "Blue" blue 10
]
AttributeNote
datablock of label/color/quantity values
options[no-label]
[start n] where n is the degrees value
[explode n] when n is the number of pixels

source:widgets/pie-chart.r

progress

A horizontal progress indicator.

progress
progress data .5
AttributeNote
datanumber from 0 to 1 indicating percentage

source:widgets/progress.r

radio-group

A group of mutually exclusive radio buttons. Alignment is vertical unless height is specified as line height (5 units).

If you provide an integer as first entry in the block, this specifies the default selection. In this case the action of the radio-group won't be called.

Note from Robert: In my version of RebGUI radio-group uses IDs for each entry, so that storing the selection becomes position independend. The block looks like this in this case: [2 "Option-1" 1 "Option-2" 2 "Option-3" 3]

radio-group data ["Option-1" "Option-2" "Option-3"]
radio-group data [2 "Option-1" "Option-2" "Option-3"]
AttributeNote
datablock with an optional integer indicating the default selection and one or more string radio labels
Runtime
pickedinteger (or none) indicating current selection
selectedstring value of currently selected option
select-iteminteger position of item to select

source:widgets/radio-group.r

slider*

A slider control. Its size determines whether it is vertical or horizontal.

slider
slider silver data .5 [print face/data]
AttributeNote
datadecimal from 0 to 1 indicating percentage
options[arrow] arrows are to be added (creating a scroller)
[together] arrows be placed together
[ratio n] where n has the same value as above but indicates the initial dragger size

source:widgets/slider.r

spinner

Similar to a field, but with a left/right click button to increment/decrement a value by a nominated step amount.

spinner options [$1 $10 $1] data $5
AttributeNote
options[min max step] block of min, max and step amounts (defaults [1 10 1]`)
dataany-type amount (defaults to min)

source:widgets/spinner.r

splitter

Placed between two widgets on the same row or column, it allows both to be resized by dragging the splitter left/right or up/down respectively. Its size determines whether it is vertical or horizontal.

area
splitter black
area

source:widgets/splitter.r

symbol

Basic single-color shapes, such as those found on media players, on an "arrow" type button. Uses "Webdings" if available, otherwise simple ASCII equivalents.

symbol data 'start
symbol data 'rewind
symbol data 'left
symbol data 'pause
symbol data 'stop
symbol data 'record
symbol data 'right
symbol data 'forward
symbol data 'end
symbol -1 "Some text"
AttributeNote
dataword specifying symbol to use
textstring to display

source:widgets/symbol.r

table*

Columns and rows of values formatted according to a header definition block.

table options ["Name" left .6 "Age" right .4] data [
    "Bob" 32
    "Pete" 45
    "Jack" 29
    "Mike" 25
    "Andy" 56
]
AttributeNote
datablock of values
options[multi] allows multiple rows to be selected at once
[no-dividers] hides column dividers
[s w d] string/word/decimal specifying column title/alignment & percentage width respectively
Runtime
datablock of values to display
pickedblock of currently selected row number(s)
selectedblock of currently selected data
redrawfunction to redraw widget after data changes
add-rowUndocumented
remove-rowUndocumented
alter-rowUndocumented
select-rowUndocumented
set-columnsUndocumented

Important: When updating a table's data use insert clear face/data [...] instead of face/data: copy [...] as the data attribute is shared by the generic face-iterator function.

source:widgets/table.r

tab-panel

A panel with a set of tabs.

tab-panel data [
    "One" [field]
    "Two" [field field]
]
AttributeNote
datablock of string/block (spec) pairs that specify each tab's layout
(each spec may be preceded by an action word/block pair that is executed prior to the face being shown)
options[action] do action of initial tab (if any)
[tab n] where n specifies tab to initially open with (default 1)
Runtime
selectedTitle string of currently selected tab

source:widgets/tab-panel.r

text

A box plus text.

text "A text string."
AttributeNote
textstring to display

source:widgets/text.r

text-list*

A single column list with a scroller.

text-list data ctx-rebgui/locale*/colors [
    print face/selected
]
AttributeNote
datablock of values to display
options[multi] allows multiple rows to be selected at once
Runtime
pickedblock of currently selected row number(s)
selectedValue (block if 'multi) of currently selected data
select-rowUndocumented
redrawfunction to redraw widget after data changes

source:widgets/text-list.r

title-group

A title and text with an optional image to the left.

title-group "Body text" data "Title text"
title-group %images/setup.png data "Title" "Body"
AttributeNote
textstring paragraph text
datastring title
imagefile or image specifying the optional image to use
(if specified the height of the widget is set to the height of the image)

source:widgets/title-group.r

tool-bar

An iconic toolbar.

tool-bar white data [
    "Open" %images/document-open.png [request-file]
    pad 2 none
    "Save" %images/document-save.png []
    "Print" %images/document-print.png []
]
AttributeNote
datablock of string/file/block values that specify each icon's tooltip, image and action respectively
(exception: a tooltip of pad followed by an integer and none will work as per the display function)

source:widgets/tool-bar.r

tooltip

Tooltip text.

tooltip "Some text."
AttributeNote
textstring to display

source:widgets/tooltip.r