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|
No setup is required, just do it.
>> do %rebdbgui.r
The above image was created running REBOL/View 220.127.116.11.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. The script includes a compressed version of Dobeash's RebDB/db.r.
From the library with:
>> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=rebdbgui.ror locally with:
>> do %rebdbgui.ror from the REBOL/View sandbox with
>> do-thru http://www.rebol.org/library/scripts/rebdbgui.r
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.
This script is an introduction to the use of RebDB within a RebGUI application.
Please see the RebGUI home page at Dobeash.com
Both RebGUI and RebDB are available
free of charge from www.dobeash.com
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.
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 www.dobeash.com .
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.
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 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.
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.
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.
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.
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.
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.
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.
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.
The code for data-field is somewhat ill-conceived and inefficient, as it will access the database for every gui redraw. It could break.
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
|%rebdbgui.r||Author: Brian Tiffin|
|RebGUI||Ashley Trüter, Dobeash Software|
|REBOL/SDK||Carl Sassenrath, REBOL Technologies|
|REBOL/View||Carl Sassenrath, REBOL Technologies|