[REBOL] Re: Layout in more than one pane
From: media:quazart at: 1-Nov-2001 15:30
I encountered the exact problem this week :-)
ok, where there are several things wrong... first is that the layout
function returns a pane within a pane... so if you just append that you'll
run into problems... cause each time your just returning the same object!
start by using b/pane/1 and you already clear one thing BUT even that face
still contains a link to the same object, you're trying to append twice...
I always thought of the "make" function as a dynamic thing. but in reality
it is a static, one time evaluation. so since you are adding your box with
a nested pane twice it is adding a different pane, but each pane references
that same and unique instance of "make b " (the VID box).
its like if you say that make b executes itself once and then every other
time its first evaluation is returned instead...
in your example, the window pane created in b is new everytime, but the pane
which holds the box is always the same... cause layout encapsulates your box
inside another pane...
there is another insidious occurence of the same kind of problem when you
just use "something: " instead of "something: copy  " within a function
which creates faces... everyone ends up refering to the same pane...
In practice, I have noticed that trying to mix VID and direct View usage is
just plain frustrating... you're better of doing just one or just the
other... otherwise it's really hard trying to make sure that binding is
exact and that problems like the one you illustrate do not crop up... (which
in my experience is sometimes impossible without a completely direct view
I would have included a "fixed" example but the truth is that it just wont
work unless I completely rewrite it... and in that case there's no real
point... in using any of the VID calls anyways...
this should work:
vidbox: layout [box "hello" 90x30 ibevel]
master-face: make face [offset: 100x100 ]
sub-face: make vidbox/pane/1 ;extract the actual box...
master-face/pane: copy 
append master-face/pane prev-face: make sub-face [offset: 0x0]
append master-face/pane make sub-face [
offset/y: prev-face/offset/y + size/y offset/x: prev-face/offset/x
I added some positioning stuff on the second make face, just to align them
hope this helps