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|
No setup is required, just do it.
>> do %rebgui-table.r
The above image was created running REBOL/View 126.96.36.199.2, RebGUI build #93, GNU/Linux 4.0, KDE Desktop.
Requires REBOL/View, access to a cached copy of RebGUI or internet access for getting a cached copy.
From the library with:
>> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=rebgui-table.ror locally with:
>> do %rebgui-table.r
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.
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.
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.
The keyword on-click is not really necessary, the first action block of a RebGUI widget is the on-click action.
set-color is a RebGUI support function for controlling colors of many RebGUI widgets.
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.
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]
Nothing to break here.
Well, REBOL/Core will not have the capabilities to run RebGUI, You will need to start up REBOL/View.
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
|%rebgui-table.r||Author: Brian Tiffin|
|RebGUI||Ashley Trüter, Dobeash Software|
|REBOL/SDK||Carl Sassenrath, REBOL Technologies|
|REBOL/View||Carl Sassenrath, REBOL Technologies|