[REBOL] Injecting data into VID?
From: joel:neely:fedex at: 27-Apr-2001 8:38
(Sorry about the cryptic subject... Best I could do in a hurry!)
Consider the following dinky bit of code:
8<--------------------
test1: make object! [
firstNames: ["John" "Jane" "Bob"]
lastNames: ["Smith" "Doe" "Doaks"]
ui: layout [
across
vh2 "Names:"
return
firstName: choice "John" "Jane" "Bob" [sayName]
lastName: choice "Smith" "Doe" "Doaks" [sayName]
return
fullName: text " " 200
return
button "Close" [unview]
]
sayName: function [] [theName] [
fullName/text: theName: join firstName/text [" "
lastName/text]
print mold theName
show fullName
]
run: function [][][
sayName
view center-face ui
]
]
test1/run
8<--------------------
The drawback of listing the first and last name choices as literal
strings in the definition of 'ui is that other parts of the code
might need to work with the same lists. However, saying
8<--------------------
; ...
firstName: choice firstNames [sayName]
lastName: choice lastNames [sayName]
; ...
8<--------------------
doesn't work. Is there a way to accomplish the goal of setting up
a data structure (e.g. firstNames) and using some operation on
that structure to initialize a 'choice list?
-jn-