Script Library: 1219 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: rebdbgui.r

Usage document for %rebdbgui.r

1. Introduction to %rebdbgui.r

rebdbgui.r is an introduction to the ease of gui creation with RebGUI and the ease at fetching and updated data in a RebDB database.

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

2. rebdbgui At a Glance

No setup is required, just do it.

>> do %rebdbgui.r


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

3. Using %rebdbgui.r

Requires REBOL/View, access to a cached copy of RebGUI or internet access for getting a cached copy. The script includes a compressed version of Dobeash's RebDB/db.r.

3.1. Running %rebdbgui.r

From the library with:

 >> do
or locally with:
 >> do %rebdbgui.r
or from the REBOL/View sandbox with
 >> do-thru

Please note. This script loads itself so if you make a local copy, it will need to match the REBOL header File: %rebdbgui.r field. If you want to call it something else on your local system, you will need to update the File: header field.

4. What you can learn

This script is an introduction to the use of RebDB within a RebGUI application.
Please see the RebGUI home page at 

Both RebGUI and RebDB are available
free of charge from 

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

RebDB makes persistent storage a breeze, and comes with an SQL flavour.

4.1. REBOL script scanning

This script includes a compressed copy of RebDB/db.r. This allows the script to execute without having to save a copy of the RebDB code. It is worth your while to download the latest and greatest from  .

This script is surrounded in an extra level of [ block markers. This allows for multiple scripts, and it uses select to name the entries. After the main %rebdbgui.r script, there is another block, tagged with the name rebdb. This code is loaded by selecting it, and doing the decompressed source code. You can save this compressed and saved code with the Source Code button.

4.2. 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.3. append-widget

This example uses custom RebGUI widgets to get at the database entries inside the data form. The main widget, edit-field is just a copy of the standard RebGUI field with the added benefit of loading itself with data by evaluating the data facet to fill the text facet when the field is initialized. It expects string! data.

4.4. Different strokes for different folks

rebdbgui uses quite a few different data update sequences. Some fields are updated and committed to the database with a button. Some fields are updated as each character is typed. One of the fields is updated, but not committed to the database to demonstrate the builtin database replay mechanics.

4.5. 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.

In a blinding example of inefficient programming, the table is updated as part of the data storage function. This is not normal coding practice for a production application.

4.5.1. 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.6. What you can change.

Go ahead and add entries to the database, but know that the form will need to be updated as well. RebDB includes a handy next feature for integer! key fields, as the id is in the case of testdb.

5. What can break

Quite a few things could break here.

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

5.1. Needs a local database

If you do not allow the creation of the testdb, the script will halt as there is nothing for it to do if there is no database.

5.2. No replay from the sandbox

The Replay Age button will only demonstrate the database uncommitted data replay if everything is in the local directory. Executing with do-thru will break this featurette.

5.3. data-field is experimental

The code for data-field is somewhat ill-conceived and inefficient, as it will access the database for every gui redraw. It could break.

5.4. Reliance on a particular version of RebGUI

The code needed from RebDB is included, RebGUI is not. The call to append-widget could break at any time as RebGUI is updated. The script will need to include a compatible copy of RebGUI if that happens. Build 95 when written.


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 

7. Credits

%rebdbgui.r Author: Brian Tiffin
RebGUI Ashley Trüter, Dobeash Software
REBOL/SDK Carl Sassenrath, REBOL Technologies
REBOL/View Carl Sassenrath, REBOL Technologies
  • The Library Team
  • Usage document by Brian Tiffin, Library Team Apprentice, Last updated: 6-Jul-2007