Separate location into horiz and vert?
Jim Lyons
jimlyons at earthlink.net
Sun Jul 11 16:56:44 EDT 2004
On Jul 11, 2004, at 3:43 PM, use-revolution-request at lists.runrev.com
wrote:
Scott Rossi wrote:
> Recently, "Marian Petrides" wrote:
>
>> Is there a way to separate location into its horizontal and vertical
>> components, e.g. hloc and vloc, so as to manipulate them
>> individually?
>
> Maybe this is what you want?
> ...
> item 1 of loc of <object>,item 2 of loc of <object>
This is easy enough when you want to get the horizontal or vertical
location, but it's more cumbersome when you want to set one of them. I
always wanted to have the locH and locV properties, so when I learned
about getprop and setprop, I wrote this and use it in the main stack
script of my projects:
-- virtual properties locH and locV
getprop locH
return item one of the loc of the target
end locH
setProp locH h
get the loc of the target
put h into item one of it
set the loc of the target to it
end locH
getprop locV
return item two of the loc of the target
end locV
setProp locV v
get the loc of the target
put v into item two of it
set the loc of the target to it
end locV
These can make your resize handlers a little easier to write, and to
understand. Just get and set these properties as you would any other,
eg, set the locH of grp "controls" to the locH of this card.
Jim Lyons
More information about the use-livecode
mailing list