Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Programatically creating layouts

From: andy:flyingcat at: 9-Sep-2002 13:02

Hi: 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 loaded. 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] ] grid_count: 0 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 halt ---- The above example doesn't work. It results in a [ ... btn 0:30 with tmp] 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 time. 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 ? Thanks, Andy