On 4 Jul 2011, at 14:11, Ken Ray wrote: > The only current way is through polling during > mouseMove, which, although ugly, is usually fast enough even if you have > hundreds of objects: > > > on mouseMove > if the mouse is down then > repeat with x = 1 to the number of controls > if the mouseLoc is within the rect of control x then > -- do what you want to do with it > else > -- take some other action > end if > end repeat > end if > end mouseMove
Scott Raney used to lecture us on avoiding polling with the mouse and mouseLoc in situations like this. It's more efficient to use the x, y parameters passed in to mouseMove. Something like this: local sDown on mouseUp put false into sDown end mouseUp on mouseRelease put false into sDown end mouseRelease on mouseDown put true into sDown end mouseDown on mouseMove x, y if sDown then repeat with k = 1 to the number of controls -- or whatver control list you need to test if (x,y) is within the rect of control k then -- do your thing here end if end repeat end if end mouseMove Cheers Dave _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode