[REBOL] Re: dynamic faces
From: arolls:idatam:au at: 26-Dec-2001 16:05
Here is a way using compose:
lay-blk: copy []
repeat i 3 [append lay-blk [progress 12x80]] ; 3 progress bars
repeat i 3 [
append lay-blk compose/deep [
button (join "modif" i) [
lpi: (to-path compose [lay pane (i)]) ; <--
lpi/data: lpi/data + 0.1
show lpi
]
]
]
view lay: layout lay-blk
The use of i, where it is marked with an arrow, is critical.
If you change your layout, for example, to add a backdrop at
the beginning, as in:
lay-blk: copy [backdrop black]
then the index will be incorrect. You will need to add one
to it, like this:
lpi: (to-path compose [lay pane (i + 1)])
Of course you could add code to track where the progress
bars were inserted and add this offset at the appropriate
moments later in the code.
Note the use of compose/deep. It is /deep so that the reach
of compose extends into sub-blocks. The calculation for lpi
is within a sub-block, so we need compose/deep.
Anton.