Page 1 of 1

Can LC get Loc of a group with respect to group not stack? - Solved

Posted: Fri May 15, 2020 5:56 pm
by DR White
Can LC get Loc of a group "test" with respect to group "ScrollArea" not stack?


I am using a scrolling group "ScrollArea" which has a height of 2000.
Group "Test" is a group within group "ScrollArea".
My stack height id 1024.

The code within group "Test" is :
on mouseUp
put loc of me into tLocMe
answer "Locaton = " & tLocMe
end mouseUp

When I touch the group "Test" that is near the bottom of group "ScrollArea",
it displays the location with respect to the stack, not the group "ScrollArea".

Is there a way to get the location the group "Test" with respect to the group "ScrollArea"?
Thanks,

David

Re: Can LC get Loc of a group with respect to group not stack?

Posted: Fri May 15, 2020 8:10 pm
by richmond62
Probably missing something. 8)
-
Screenshot 2020-05-15 at 22.08.56.png

Re: Can LC get Loc of a group with respect to group not stack?

Posted: Fri May 15, 2020 8:38 pm
by FourthWorld
Groups have hScroll and vScroll properties, which are the number of pixels the group has been scrolled to on the horizontal and vertical axes, respectively. Also affecting interior coordinates will be the group's borderWidth and margins.

So to find a location of an object relative to its parent group, get the object's location and add the vScroll to the first item and the yScroll to the second. If your group has non-zero margins subtract those from the scroll values, along with the borderWidth of the group.

Re: Can LC get Loc of a group with respect to group not stack?

Posted: Fri May 15, 2020 9:16 pm
by DR White
Thanks for the Guidance,

David