[REBOL] Dynamic face positioning
From: coussement:c:js:mil:be at: 25-Jun-2001 11:55
Hi list:
A little trick I just found out ;-)
Because I've to develop some GUI for my project, and it's sometimes tricky
to place all your faces on your background - you known ... set offset, run,
modify offset, run, modify again ... - I thought it should be great doing
that on a more "intuitive" way ... like drag&drop .
So I hacked my code by using the *engage* func like in this example:
<snip>
move: [
engage: func [face action event][
if action = 'down [start: event/offset]
if find [over away] action [
face/offset: face/offset + event/offset - start
print face/offset
show face
]
]
]
lay: layout/size [
box 50x50 "Hello" red feel move ;<<<<<
slider 10x100 feel move ;<<<<<
] 200x200
view lay
</snip>
Because of the *print face/offset*, I can read the current pos of the face
I'm moving. When I'm happy with it, I just note that and set the object
static by an *at* or *offset* or whatever.
When all is OK, I just remove the *feel move* code.
It's handy, easy, and I win A LOT of time !
BTW, I should perhaps propose this for the next /Zine. What do you think ?
Hopes this helps somebody ;-))
chr==