Documention for: rebgui-table.r Created by: btiffin on: 4-Jun-2007 Last updated by: btiffin on: 4-Jun-2007 Format: text/editable Downloaded on: 30-Apr-2025 [h1 Usage document for %rebgui-table.r [contents [numbering-on [h2 Introduction to %rebgui-table.r [p rebgui-table.r is an introduction to the ease of gui creation with RebGUI. [table/att/border="1px"/att/cellpadding="4px" [row [cell **gui** [cell Graphic User Interface, usually pronounced as gooey [row [cell **widget** [cell A RebGUI graphical element [row [cell **VID** [cell REBOL/View Visual Interface Dialect table] [h2 rebgui-table At a Glance [p No setup is required, just **do** it. [asis >> do %rebgui-table.r asis] [p [image http://www.rebol.org/library/arts/accessories/kg55x/rebgui-table-1.png "rebgui-table.png" [p The above image was created running REBOL/View 2.7.5.4.2, RebGUI build #93, GNU/Linux 4.0, KDE Desktop. [h2 Using %rebgui-table.r [p Requires REBOL/View, access to a cached copy of RebGUI or internet access for getting a cached copy. [h3 Running %rebgui-table.r [p From the library with: [asis/style/font-size:75% >> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=rebgui-table.r asis] or locally with: [asis >> do %rebgui-table.r asis] [h2 What you can learn [p This script is an introduction to the **display** function and **table** widget of RebGUI. [br Please see the [link http://www.dobeash.com/rebgui.html "RebGUI home page at Dobeash.com" [p Both REBOL/View and RebGUI are available [br **free of charge** from [link http://www.rebol.com "www.rebol.com" and [link http://www.dobeash.com/rebgui.html "www.dobeash.com" [p RebGUI gui building is **easy**, and offers a flexible 'business polish' to application design. There are many features under the hood. [h3 do-thru [p 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. [p 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. [h3 The table widget [p 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. [p When running, you can sort the columns, move the splitter, select an entry by simply clicking...and other nifty things. [h4 on-click [p The keyword **on-click** is not really necessary, the first action block of a RebGUI widget is the **on-click** action. [h4 set-color [p **set-color** is a RebGUI support function for controlling colors of many RebGUI widgets. [h4 do-events [p 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. [h3 What you can change. [p For early experiments with your local copy, try adding a column, perhaps the inverted color value. [p Change the foreach loop to build the table-data [asis ; 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 ] asis] 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. [asis ; 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] asis] [image http://www.rebol.org/library/arts/accessories/kg55x/rebgui-table-2.png "rebgui-table-2.png" [h2 What can break [p Nothing to break here. [p Well, REBOL/Core will not have the capabilities to run RebGUI, You will need to start up REBOL/View. [h3 REBOL/SDK [p 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 [link http://www.dobeash.com/rebgui.html "RebGUI Home" [h2 Credits [table/att/border="1px"/att/cellpadding="4px" [row [cell %rebgui-table.r [cell Author: Brian Tiffin [row [cell RebGUI [cell Ashley Trüter, Dobeash Software [row [cell REBOL/SDK [cell Carl Sassenrath, REBOL Technologies [row [cell REBOL/View [cell Carl Sassenrath, REBOL Technologies table] [list [li The rebol.org Library Team [li Usage document by Brian Tiffin, Library Team Apprentice, [date list]