Is it possible to identify when the cursor is within a group?
J. Landman Gay
jacque at hyperactivesw.com
Thu Jul 15 19:58:54 EDT 2004
On 7/15/04 6:14 PM, Howard Bornstein wrote:
> Since I'm creating and destroying a variety of groups randomly, I need
> to know which group the mouse is over via some kind of test (the very
> thing I'm stumped on). Unfortunately, I can't seem to find a way to do
> this if the mouse is simply within the group rect but not over an
> object. There are some fairly extreme approaches to solving this
> problem, but I'm hoping for a simple solution.
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.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list