location 'math'

Ken Ray kray at sonsothunder.com
Tue Aug 20 14:50:01 EDT 2002


> I understand the concept, and that locations are referenced as the center
> a stack object. What I need to know is the actual syntax. When you get the
> location of something, its returned as "200,300". How do you subtract 150
> from the 300 part of that returned value?

Use the "item" chunk expression:

  item 2 of (the location of this stack) - 150

> Specific example: I want to set the palette's location on the left side of
> the main stack, aligned at the top. I need to set the palette's location
> (-150,-120) relative to the main stack. So, I get the location of the main
> stack; say its currently at "400,600". Now what's the actual syntax of the
> set location command for the palette?

put the loc of this stack into tStackLoc
set the loc of stack "myPalette" to ((item 1 of tStackLoc) - 150),((item 2
of tStackLoc) - 120)

Hope this helps,

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

More information about the Use-livecode mailing list