Accessing facets without using variables?
[1/2] from: jose:8inc at: 8-Jun-2001 20:07
Greeting all,
If I have something like:
main: layout [
foo: button "Hi"
]
Then I can modify a facet with something like:
foo/offset: 0x10
Let's say I have a bunch of buttons that I have added to a layout with
a loop, is it possible to modify the properties of that face without
assigning it to a variable? Perhaps with some magic path along the lines of:
main/pane/something/offset: 0x10
Thanks,
Jose
[2/2] from: brett::codeconscious::com at: 9-Jun-2001 10:58
Hi Jose,
Here some example code.
;------------------------------
; Build a face using layout. The boxes will all be in a vertical line.
layout-spec: copy [style bx box 10x10]
num-boxes: 10
for i 1 num-boxes 1 [
append layout-spec compose [bx (multiply i divide 255.255.255 num-boxes)
user-data 'my-box]
]
; Show the main face - a vertical line of boxes.
view out: layout layout-spec
; Put the boxes into a diagonal
offset: 0x0
foreach face out/pane [
offset: offset + 10x0
if probe face/user-data = 'my-box [face/offset: face/offset + offset ]
]
; Fix up the size of the main face - so that the boxes can be seen.
last-box: last out/pane
out/size: add add last-box/offset last-box/size 20x20
; Show the modified main face - boxes are shown diagonally.
view out
;------------------------------
HTH,
Brett