RebGUI for Rebol quick start tutorial
RebGUI is an alternative to the standard Rebol/View functions.
Assuming that you have downloaded rebgui.r from rebol.org scripts and placed it in your Rebol directory from which you started Rebol, this should suffice to test:
do %rebgui.r
display “Example” [
text "Hello World!"
]
do-events
Be sure that you follow the do-events with a carriage return or the window that opened will be unresponsive.
For starters this is not simpler than VID’s
view layout [text "Hello World"]
Where RebGUI shows its strength when using and styling widgets.
The basic display function takes a string title and a spec block:
DISPLAY title spec /dialog /maximize /parent /position offset /min-size size /close closer
One simple comparison is to run
source view
which takes a page and then
source display
which will likely scroll your Rebol console. >>help display reveals key refinements such as display/dialog and display/parent
Carl Sassenrath posted a short article with a few comments and a demo script. There is a user guide at Dobeash and a cookbook by Ashley G TrĂ¼ter.
When the time comes to create your own custom widget, Anton Rolls has a Rebol tutorial covering the basics.
The SVN repository is a trac if you need code more recent than the scripts at rebol.org
To run the RebGUI demo you only need
REBOL [Title: "RebGUI Demo"]
do http://www.dobeash.com/RebGUI/get-rebgui.r
do view-root/public/www.dobeash.com/RebGUI/tour.r
Browsing the tour.r source is a good exercise for starters:
; wrap display in a func so it can be called by request-ui
do show-tour: make function! [] [
display rejoin ["Widget Tour (build#" ctx-rebgui/build ")"]
The call from request-ui is found further below as:
button “request-ui” [all [request-ui unview/all show-tour]]
with the useful unview function whose source is
unview: func [
"Closes window views, except main view."
/all "Close all views, including main view"
/only face [object!] “Close a single view”
/local pane
][
pane: head system/view/screen-face/pane
either only [remove find pane face] [
either all [clear pane] [remove back tail pane]
]
show system/view/screen-face
]
“unview” is an idiom that only a Rebol could embrace.
“rejoin” is of course reduce-and-join a block, i.e.,
if empty? block: reduce block [return block]
append either series? first block [copy first block] [
form first block
] next block
Leave a Reply