Script Library: 1225 scripts
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 
View scriptLicenseDownload documentation as: HTML or editable
Download scriptHistoryOther scripts by: btiffin

Documentation for: rebgui-table.r


Usage document for %rebgui-table.r

1. Introduction to %rebgui-table.r

rebgui-table.r is an introduction to the ease of gui creation with RebGUI.

gui Graphic User Interface, usually pronounced as gooey
widget A RebGUI graphical element
VID REBOL/View Visual Interface Dialect

2. rebgui-table At a Glance

No setup is required, just do it.

>> do %rebgui-table.r
 

rebgui-table.png

The above image was created running REBOL/View 2.7.5.4.2, RebGUI build #93, GNU/Linux 4.0, KDE Desktop.

3. Using %rebgui-table.r

Requires REBOL/View, access to a cached copy of RebGUI or internet access for getting a cached copy.

3.1. Running %rebgui-table.r

From the library with:

 >> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=rebgui-table.r
 
or locally with:
 >> do %rebgui-table.r
 

4. What you can learn

This script is an introduction to the display function and table widget of RebGUI.
Please see the RebGUI home page at Dobeash.com 

Both REBOL/View and RebGUI are available
free of charge from www.rebol.com  and www.dobeash.com 

RebGUI gui building is easy, and offers a flexible 'business polish' to application design. There are many features under the hood.

4.1. do-thru

This example uses the REBOL/View do-thru feature. do-thru will execute a script from the REBOL/View sandbox (another name for cache). It will retrieve the code from the internet, only if there is not a cached copy.

If you do develop something with RebGUI, and build it using the REBOL/SDK, you may not have access to do-thru. The RebGUI home site explains all this. This is just an example, and assumes you are using a full fledged REBOL/View.

4.2. The table widget

This short example highlights the ease and power of the table widget in RebGUI. As just an example, it does no real justice to the full power of table and RebGUI widgets.

When running, you can sort the columns, move the splitter, select an entry by simply clicking...and other nifty things.

4.2.1. on-click

The keyword on-click is not really necessary, the first action block of a RebGUI widget is the on-click action.

4.2.2. set-color

set-color is a RebGUI support function for controlling colors of many RebGUI widgets.

4.2.3. do-events

The standard REBOL event handler is used by RebGUI. do-events is used to start the event handling loop in REBOL. The REBOL/View view function includes a call to this event loop. RebGUI requires it to be called separately, a feature that allows for processing between and around the GUI layout, the display and handling the events.

4.3. What you can change.

For early experiments with your local copy, try adding a column, perhaps the inverted color value.

Change the foreach loop to build the table-data

 ; Build a data table, three columns; color name and color tuples
 table-data: copy []
 foreach color ctx-rebgui/locale*/colors [
     append table-data color
     append table-data get color
     append table-data subtract 255.255.255 get color
 ]
 
and then update the options block for the table headers. In the action block, pick the third item to change the bbox color, instead of recalculating. The table was made a little bigger, and the percentages for the columns were also changed, just for the looks.
 ; Display a RebGUI table
 display "RebGUI table Example" [
   table 75x25 options ["Color" left .25 "RGB" right .375 "-RGB" right .375] data table-data
      on-click [set-color abox second face/selected   set-color bbox third face/selected]
 
rebgui-table-2.png

5. What can break

Nothing to break here.

Well, REBOL/Core will not have the capabilities to run RebGUI, You will need to start up REBOL/View.

5.1. REBOL/SDK

The RebGUI designer, Ashley Trüter has taken great strides to allow the REBOL/SDK to build a RebGUI application that does not require all the REBOL/View features for a lean, mean application. Full information starts at the RebGUI Home 

6. Credits

%rebgui-table.r Author: Brian Tiffin
RebGUI Ashley Trüter, Dobeash Software
REBOL/SDK Carl Sassenrath, REBOL Technologies
REBOL/View Carl Sassenrath, REBOL Technologies
  • The rebol.org Library Team
  • Usage document by Brian Tiffin, Library Team Apprentice, Last updated: 4-Jun-2007