top location of object

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

top location of object

Post by jalz » Wed May 14, 2014 6:48 pm

Hi Guys,

Hopefully a simple question, I have a card with many objects placed in various positions. When I highlight the object, I want to obtain the top location of the object.

I thought the following command (which I'm typing in the message box) would help me obtain the top location of the object, if I have it selected.
answer the top of me

However this produces 507 regardless of which object is highlighted. Anyone point me in the right direction please, tried top,left etc but they all produce same values on different objects on the card.

Thanks as always Jalz

sefrojones
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 447
Joined: Mon Jan 23, 2012 12:46 pm

Re: top location of object

Post by sefrojones » Wed May 14, 2014 7:03 pm

I think what you're looking for is something like this:

Code: Select all

  answer (item 2 of the rect of me)

--Sefro

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: top location of object

Post by dunbarx » Wed May 14, 2014 7:26 pm

If you ask for the top (or anything) of "me" in the message box, well, wait a minute. You can do this yourself.

try this in the message box:

Code: Select all

answer the name of me
Now lets get going on learning about object references. Please read in the dictionary: "target". "me", "selectedObject".

What you want to do is to make sure the line of code makes sense to LC. If you think about it, how would the message box know which object you had in mind? The items above are powerful xTalk gadgets, but mostly, you will lay out explicit object references.

Write back with your thoughts...

Craig Newman

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: top location of object

Post by jalz » Wed May 14, 2014 7:36 pm

Thanks to both for replying,

Craig, I thought I was going mad, of course I should have realised I was in the context of message box - duh :oops:

I'm now targeting the top of the fields, and all is good.

Jalz

Post Reply