[REBOL] Re: Dynamic Layout creation
From: sunandadh:aol at: 15-Mar-2002 13:45
[riusa--email--it] writes:
> the previous code functions. But how can I do to assign a different
> variable to every radio-button (see the hypotetical result below):
I don't know how to do it directly, but the approach I would use is to
collect them in a block via a temporary variable, using DO i the layout.
After the layout is executed you can do what you like with the block - though
don't try to print it -- it's full of vid objects and will take a while.
This code may make as much sense as the explanation...
-------
myBlock: [backcolor gray across]
myvars: copy []
loop 10 [
append myBlock [temp: radio label "test"
do [append myvars temp]
] ;; append
] ;; loop
unview/all
view/new layout myBlock
;; now you can manipulate the faces directly, eg
;; set every 2nd radio button true
for nn 1 length? myvars 2 [
myvars/:nn/data: true
show myvars/:nn
]
;; or extract them into variables --
;; (as per an earlier thread, this puts
;; them into an object -- you can automate
;; this code a bit more, especially the object
;; definition)
myobj: make object! [var1: "" var2: "" var3: "" var4: "" var5: ""
var6: "" var7: "" var8: "" var9: "" var10: ""]
for nn 1 length? myvars 1 [
set in myobj to-word join "var" nn myvars/:nn]
;; and then mess with them in the object
myobj/var2/data: true
show myobj/var2
-----------
Sunanda