|
Pages: [1]
|
 |
|
Author
|
Topic: choice > options (Read 251 times)
|
|
leke
|
I made this for linux, but it always evaluates the first block. How do I make each choice evaluate its own block? view layout [ size 700x350 choice "Interet Apps" [alert "Not an option"] "Firefox" [call "firefox"] "Trasmission" [call "transmission-gtk"] "Miro" [call "miro"] "5" [call ""] ]
Thanks.
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
You may have mis-interpreted the format of a choice. It is a set of display strings and a _single_ action block. The action block can check which display option is currently selected. Try this to see: view layout [ size 700x350 my-choice: choice "Interet Apps" "Firefox" "Trasmission" "Miro" "5" [print my-choice/text] ]
|
|
|
|
|
Logged
|
|
|
|
|
leke
|
thanks, I found this also: http://en.wikibooks.org/wiki/REBOL_Programming/Language_Features/VID#Choice which helped me code the rest of the app. Could you maybe explain a little about the refinements /data/1 ? rebol[] view layout [ size 700x350
my-choice: choice "Interet Apps" "Firefox" "Trasmission" "Miro" [ switch my-choice/data/1 [ "Interet Apps" [alert "Not an option."] "Firefox" [call "firefox"] "Trasmission" [call "transmission-gtk"] "Miro" [call "miro"] ] ] ]
|
|
|
|
|
Logged
|
|
|
|
|
Sunanda
|
Glad you've got your code working :-)
Not sure I can explain about data/1. But here goes:
VIEW stores text information in various places. They include /text (which, with 'choice, is I think the current displayed/selected option) and /data which may be a block of all possible options.
The usage of /text and /data has changed between versions of VIEW and it has been inconsistent between different controls. So I cannot give you a definite answer. Use 'probe and experiment to see what works on your version.
|
|
|
|
|
Logged
|
|
|
|
|
leke
|
thanks - that was great! 
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |