relative position of a target within a group

Phil Davis revdev at pdslabs.net
Fri Feb 19 21:27:32 EST 2010


Hi Mark,

Here's one way you can use with any grouped object.

on mouseUp -- in a grouped button
    put the locWithinGroup of me
end mouseUp


getProp locWithinGroup
    -- return card-relative loc if target object is not in a group
    if word 1 of the name of the owner of the target is not "group"
    then return the loc of the target

    -- return the loc of the target object relative to its 'owner' group
    return \
           (item 1 of the loc of the target - the left of the owner of 
the target), \
           (item 2 of the loc of the target - the top of the owner of 
the target)
end locWithinGroup

HTH -
Phil Davis


On 2/19/10 1:55 PM, Mark Swindell wrote:
> How does one get the relative position of a button within a group of buttons?
>
> I want to
>
> 	put the (relative to group myGroup) number of the target into vMyVar
>
> One can say
>
> 	select button 3 of group myGroup
>
> without problem.
>
> But how would one best do this using the target function?
>
>
> Thanks,
> Mark
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>    

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list