[REBOL] Re: R: Dynamic Layout creation
From: brett:codeconscious at: 16-Mar-2002 15:52
Hi,
> I assume it's something to do with "Binds words to global
> context." as mentioned with 'load's help...
Sounds right to me.
If you want the TO-BLOCK method to work you can use BIND explicitly
like this:
A: "b1: button {prova}"
la: to-block a
b1: none ; (A)
bind la 'b1 ; (B)
view layout la
>> b1/text
== "prova"
or perhaps like this:
A: "b1: button {prova}"
la: to-block a
obj-a: context [b1: none]
view layout la
>> obj-a/b1/text
== "prova"
In these cases b1 is assigned a context.
In the first example B1 is part of the global context (like what LOAD
does). Note that the line marked (A) is actually unnecessary. I left it
there because I wanted to draw attention to what B1: in the block will
be bound to. In fact the 'B1 on line (B) creates a word B1 in the
global context anyway - so you can remove line (A) and the first
example still works. Line (B) then binds the B1: inside the block to
the global context.
In the second example the B1: is bound to an object context.
Regards,
Brett.