Page 1 of 1

top location of object

Posted: Wed May 14, 2014 6:48 pm
by jalz
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

Re: top location of object

Posted: Wed May 14, 2014 7:03 pm
by sefrojones
I think what you're looking for is something like this:

Code: Select all

  answer (item 2 of the rect of me)

--Sefro

Re: top location of object

Posted: Wed May 14, 2014 7:26 pm
by dunbarx
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

Re: top location of object

Posted: Wed May 14, 2014 7:36 pm
by jalz
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