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
Can LC get Loc of a group with respect to group not stack? - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Can LC get Loc of a group with respect to group not stack? - Solved
Last edited by DR White on Sat May 16, 2020 8:43 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Can LC get Loc of a group with respect to group not stack?
Probably missing something.
-

-
-
- VIP Livecode Opensource Backer
- Posts: 10049
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Can LC get Loc of a group with respect to group not stack?
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.
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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Can LC get Loc of a group with respect to group not stack?
Thanks for the Guidance,
David
David