[beginner] x,y coordinates in LiveCode

dunbarx at aol.com dunbarx at aol.com
Sat Jan 10 13:03:23 EST 2015


Colin.


What did you mean by "testing"?



I take it back. I had both a "mouseWithin" and a "mouseEnter" handler in the same script, just fooling around. When I comment out the "mouseEnter", the "mouseWithin" is not sent. And this is spelled out in the dictionary. Well what do you know?


Craig


-----Original Message-----
From: Richard Gaskin <ambassador at fourthworld.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Sat, Jan 10, 2015 12:51 pm
Subject: Re: [beginner] x,y coordinates in LiveCode


Shawn Bl wrote:

> I'm trying to find the x,y coordinates with a mouse hover to find the
> location of buttons on my card.
>
> Perhaps a little stack or something.  Trying to create a menu and need to
> the x,y coordinates for several buttons.

Like most languages, LiveCode provides a way to express the bounding 
rectangle of an object, as well as its location.

But it may be helpful to note that these values may be different from 
what you'll find in other languages.

For example, in JavaScript/CSS, the order of rectangle coordinates is:

    top, right, bottom, left

...but in LiveCode (and other xTalks) the order is:

    left, top, right, bottom

Also, in some other languages the location property is a pair of 
coordinates expressing the top-left of the object, but in xTalks like 
LiveCode the location is the centerpoint of the object.  Thankfully both 
languages use the same order for points, x,y.

Possibly beyond the scope of your interest, if you're coming from a CSS 
background it can be helpful to remember that the margin property in LC 
is the opposite how it's used in CSS: in CSS the margin defines the area 
outside of the control's border, but in LiveCode is defines the boundary 
within the border (such as the space between the edge of a field and the 
text within it).

In LiveCode you can observe and modify the size and location properties 
of selected controls with the "Size and Position" pane of the Inspector.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 




More information about the use-livecode mailing list