|View script||License||Download documentation as: HTML or editable|
|Download script||History||Other scripts by: btiffin|
Script Library: 1226 scripts
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.
2. rebgui-table At a Glance
No setup is required, just do it.
>> do %rebgui-table.r
The above image was created running REBOL/View 220.127.116.11.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.ror 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.
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.
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.
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.
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]
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.
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