Is it possible to identify when the cursor is within a group?

Howard Bornstein bornstein at
Thu Jul 15 19:31:58 CDT 2004

  Alex Tweedly wrote:

> Depending on how many groups you are likely to have you could do 
> something along the lines of
> on mouseMove
>   get the number of controls of the target
>   repeat with x = 1 to it
>     if the name of control x contains "group" then
>       if mouseLoc() is within the rect of control x then
>         put x & cr into msg    -- do your real work here
>       else
>         put "" into msg
>       end if
>     end if
>   end repeat
> end mouseMove

Thanks Alex. I think I'll end up doing something like this as there 
doesn't seem to be a way to get this information directly.

Jacqueline Landman Gay wrote:

> I think you'll have to scan the groups on mousemove. Something like:
> on mouseMove x,y
>  repeat with n = 1 to the number of grps
>   if x,y is within the rect of grp n then
>     get n
>     exit repeat
>   end if
>   -- now "it" contains the group number
> end mouseMove
> I had to do something similar in my Klondike game and I was afraid it 
> wouldn't be fast enough, but there was no noticeable lag. I suppose it 
> depends on how many groups you have but it is worth a try.

Ditto. There really won't be that many groups at one time. I'd rather 
not brute-force it if there was another alternative, but I think this 
will work fine. Thanks for your comments.

On Jul 15, 2004, at 7:48 PM, Pat Trendler wrote:

> How about if you had a control, at the lowest layer, the same size as 
> your
> group.

I had played with that but I think it will be just as easy to use one 
of the above methods to determine when I'm in the group and then moving 
it should work out fine.

Thanks for everyone's help!


Howard Bornstein
D E S I G N   E Q

More information about the use-livecode mailing list