Documention for: rebdbgui.r Created by: btiffin on: 3-Jul-2007 Last updated by: btiffin on: 6-Jul-2007 Format: text/editable Downloaded on: 28-Jul-2026 [h1 Usage document for %rebdbgui.r [contents [numbering-on [h2 Introduction to %rebdbgui.r [p 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. [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 rebdbgui At a Glance [p No setup is required, just **do** it. [asis >> do %rebdbgui.r asis] [p [image http://www.rebol.org/library/arts/accessories/kg55x/rebdbgui.png "rebdbgui.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 %rebdbgui.r [p 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. [h3 Running %rebdbgui.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=rebdbgui.r asis] or locally with: [asis >> do %rebdbgui.r asis] or from the REBOL/View sandbox with [asis >> do-thru http://www.rebol.org/library/scripts/rebdbgui.r asis] [p 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. [h2 What you can learn [p This script is an introduction to the use of RebDB within a RebGUI application. [br Please see the [link http://www.dobeash.com/rebgui.html "RebGUI home page at Dobeash.com" [p Both RebGUI and RebDB are available [br **free of charge** from [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. [p RebDB makes persistent storage a breeze, and comes with an SQL flavour. [h3 REBOL script scanning [p 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 [link http://www.dobeash.com "www.dobeash.com". [p 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 **select**ing it, and **do**ing the **decompress**ed source code. You can save this **compressed** and **save**d code with the **Source Code** button. [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 append-widget [p 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. [h3 Different strokes for different folks [p 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. [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. [p 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. [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 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**. [h2 What can break [p Quite a few things could break here. [p REBOL/Core will not have the capabilities to run RebGUI, You will need to start up REBOL/View. [h3 Needs a local database [p 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. [h3 No replay from the sandbox [p 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. [h3 data-field is experimental [p The code for data-field is somewhat ill-conceived and inefficient, as it will access the database for every gui redraw. It could break. [h3 Reliance on a particular version of RebGUI [p 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. [h2 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 %rebdbgui.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]