[REBOL] Programatically creating layouts
From: andy:flyingcat at: 9-Sep-2002 13:02
Thanks for all the help so far. I look forward to the day when this
becomes natural, and I can start answering questions, rather than asking
them all the time :-)
My question today is one relating to variable scoping, basically. I'm
creating layouts dynamically, from tables and files. So I'm creating a
big block, containing my layout definition (using append). I'm running
into a problem, where part of the statement needs to be evaluated at the
time of the append, and part needs to be evaluated when the layout is
A simple example might explain the problem better:
REBOL [ ]
test_list: [ "name of title" 00:30 ]
mygrid: [style btn button with [grid-offset: none grid_time: none] ]
foreach [channel title time ] test_list [
append mygrid "bn-01"
append mygrid [btn]
append mygrid title
append mygrid [with]
tmp: compose [grid_time: time]
append mygrid [tmp]
grid-f: layout load mygrid
print mold mygrid
The above example doesn't work. It results in a [ ... btn 0:30 with
I'm trying to load the btn/grid-time with the times from the test_list.
As far as I know, that means I use 'with . So I'm trying to get the
proper block created to load.
If I don't put [ ] around tmp, the statement contained within tmp gets
evaluated , and I lose the "grid_time: " part of it.
If I do put [ ] around tmp, I end up with [with tmp] which means that I
end up evaluating tmp at load time, so every entry ends up with the same
I'm sure there's some combination of compose, join, and reduce that will
give the right results....can anyone point me in the right direction ?