how to combine mouseEnter & mouse is Down?

Devin Asay devin_asay at byu.edu
Tue Oct 22 11:42:54 EDT 2013


On Oct 22, 2013, at 7:00 AM, Tiemo Hollmann TB wrote:

> Hello,
> 
> I want to fire an action, when the mouse is entering an image, while the
> mouse is down. The problem is, that I don't get the message "mouseEnter"
> while the mouse is down.
> 
> I could work around with mouseMove and testing the mouseloc within the rect
> of the image, but I wonder, if there is a more straight forward solution?

Tiemo,

As you said, most mouse messages are not sent while the mouse is down. But mouseMove is. When I need to do things like this I just use 'is within' or 'within()' inside a mouseMove handler. The main drawback is you have to check for every potential target inside your mouseMove handler. On the other hand, you can limit the targets to only the objects you are interested in. Here's an example I've used for dragging an object to various 'hot spots'.

on mouseDown
  grab the target
end mouseDown

on mouseMove
  if the mouseLoc is within the rect of image "myimg" then -- or any object
    # do stuff here
   end if
end mouseMove

HTH

Devin


Devin Asay
Learn to code with LiveCode University
http://university.livecode.com





More information about the use-livecode mailing list