|
Pages: [1]
|
 |
|
Author
|
Topic: A Rebol application with multiple GUIs (or Views) (Read 782 times)
|
|
jfdutcher
|
I have historically used CGI and HTML to dialog with a user via a GUI interface.
In these cases each new 'screen' or 'view' or 'interface' was a separate HTML page or a separate script which created a separate page.
I'm starting down the same road with rebol....whenever I need a new 'view' or GUI I pass some args and 'do' another Rebol script which has in it another new 'view' etc.
Is this a satisfactory approach....or do those who know what they are about try and have many views in one script.....'showing' and 'hiding' them as needed...and kind of winding up with a whole application in a script ??
|
|
|
|
|
Logged
|
|
|
|
|
Graham
|
The latter I think.
|
|
|
|
|
Logged
|
|
|
|
|
notchent
|
I like to keep everything in one script. Use a conditional evaluation (if, switch, etc.) to check the value submitted to the script, and then print the appropriate forms based on what's been submitted: selection: decode-cgi system/options/cgi/query-string if selection/2 = (value from first form) [...print a page base on that value ...] if selection/2 = (value from second form) [...print a page base on that value ...] if selection/2 <> none [ ...print an error page... ] [ ...print your initial page... ] Take a look at http://musiclessonz.com/rebol.html#section-6.5 (the second to last example in that section has an example of this). - Nick Antonaccio
|
|
|
|
|
Logged
|
|
|
|
|
Anton
|
Hi, it's a bit unclear to me what you want to do. Do you want to convert an existing cgi+html set of dialogs to rebol ? ie. Is it a requirement that users running your program from the web and running it directly from their OS desktop should see as similar a set of views as possible ?
Or, are you just wondering what the best way to make a GUI in an application is ? I can try to answer this last question. Rebol/View can open one or multiple windows simultaneously. These appear as normal windows in the OS desktop.
Open a single window:
view layout [button "hello"] ; waits for events - returns when window closed
Open a single window, another way:
view/new layout [button "hello"] ; open a window without waiting for events do-events ; starts waiting for events - returns when all windows are closed
Open two windows:
view/new window1: layout [text "This is window #1"] view/new window2: layout/offset [field "This is window #2"] 100x200 do-events ; wait for events - returns when all windows are closed
Open one window and when it is closed, open a second:
view window1: layout [text "This is window #1"] view window2: layout/offset [field "This is window #2"] 100x200
Open a main window which can open a "child" window:
view layout [ text "This is the main window" button "open child" [ view/new center-face layout [text "I am the child window"] ] ]
So, in the above BUTTON's action block, using VIEW with the /NEW refinement avoids waiting for events a second time, as the wait loop is already running. (The button's action block is only done because the wait loop sends mouse click events to the button's feel, which then does the action block. Hence, WAIT is doing the action, and there is no need to WAIT again.)
It's also possible to use buttons to select different panels:
details-panel: layout [ title "details" check-line "apples" check-line "oranges" ] prefs-panel: layout [ title "prefs" across label 100 "username:" field return label 100 "password:" field hide return ]
view layout [ button "details" [ my-panel/pane: details-panel/pane show my-panel ] button "prefs" [ my-panel/pane: prefs-panel/pane show my-panel ] return my-panel: box (2x2 + max prefs-panel/size details-panel/size) edge [size: 1x1 color: black] [] ]
p.s. To understand the difference between VIEW and VIEW/NEW, check the source of the VIEW function:
>> source view
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |
News: 01-09-08 Alpha version of REBOL 3 has been released!
2234 Posts in 582 Topics by 1745 Members
Latest Member: vectlycle
|