relative position of a target within a group
Scott Rossi
scott at tactilemedia.com
Fri Feb 19 17:57:28 EST 2010
Recently, 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?
Here's one way:
on mouseUp
put 0 into clickedButton
repeat with N = 1 to number of btns of me
if long id of the target = long id of btn N of me then
put N into clickedButton
exit repeat
end if
end repeat
answer clickedButton
end mouseUp
Or a function:
on mouseUp
answer clickedButton(long id of the target,long id of owner of the
target)
end mouseUp
function clickedButton pTargetButton,pGroup
repeat with N = 1 to number of btns of pGroup
if pTargetButton = long id of btn N of pGroup then
return N
end if
end repeat
return 0
end clickedButton
Not sure if there's any easier way.
Regards,
Scott Rossi
Creative Director
Tactile Media, UX Design
More information about the use-livecode
mailing list