On Jan 25, 2010, at 3:32 PM, Devin Asay wrote: > Hi John, > > On Jan 25, 2010, at 2:15 PM, John Patten wrote: >> …
>> Anyone done anything similar with a transparent grid? >> >> The grid would sit on top of an image, like for example a map, and the >> colorizing would enable the user to, essentially, focus in on a >> particular part of the image below. > > The problem with most mouseMessages is that they are only sent to the object > where the action originates. What is more, most mouse messages, like > mouseEnter and mouseLeave, are not sent while the mouse is held down. The > exception is mouseMove, which gets sent all the time, even when the mouse > button is down. When I have had to do similar things to what you're doing, I > have used a mouseMove handler and checked to see if the mouse is within > various objects. If there aren't too many objects you're checking a switch > statement seems to work well. Something like: > > on mouseMove > put the mouseLoc into tLoc > switch > case tLoc is within btn "a" > -- do stuff to btn "a" > break > case tLoc is within btn "b" > -- do stuff to btn "b" > break > -- etc., etc. > end switch > end mouseMove > If there are too many objects: You might name your rectangles in such a way that once you calculate which grc is under the cursor by the cursor location, you can refer to it by name. Lets say each grid rect is 100 pixels. gridX = (mouseX - gridLeft) div 100 gridY = (mouseY - gridlTop) div 100 Then if the grid rects are named "grid X Y", you can compose grid rect names with something like merge( "grid [[ gridX ]] [[ gridY ]]" ) or "grid" && gridX && gridY. If you layer the grcs very carefully, you can calculate which grc is under the cursor and refer to it by number (which is faster than by name, I believe). Dont forget to detect whether the mouse is outside the grid! t -- Tereza Snyder Califex Software, Inc. <www.califexsoftware.com> _______________________________________________ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution