DragRelease handler always executed after releasing the mouse button?

Posted by Twisol on Tue 29 Dec 2009 08:55 PM — 3 posts, 9,872 views.

USA #0
This is just a question out of curiosity, but why is the ReleaseCallback handler always executed, even if the mouse hasn't moved a bit (and hence DragCallback hasn't been executed either)? It sort of seems to break expected behavior, given that all of the other callbacks have a specified, documented order. It doesn't particularly affect me, but it made me wonder.


It's also worth mentioning, I suppose, that the documentation for ReleaseCallback (in the WindowDragHandler() file) says this:

Quote:
ReleaseCallback - the script function to be called when you mouse down in the hotspot rectangle


Maybe that should be "release the mouse button that was pressed in the hotspot rectangle"? It doesn't matter where the mouse is when you release it, the ReleaseHandler will still be called. It's a minor nit, obviously, but since I'm on the subject...
Amended on Tue 29 Dec 2009 08:56 PM by Twisol
Australia Forum Administrator #1
Clearly there is a documentation problem.

I have amended:


MoveCallback - the script function to be called when you move the mouse away from the hotspot rectangle

ReleaseCallback - the script function to be called when you mouse down in the hotspot rectangle


to read:


MoveCallback - the script function to be called when you move the mouse

ReleaseCallback - the script function to be called when you release the mouse


However I don't agree that the behaviour is wrong. The move callback is called when you move the mouse which may happen zero or many times. I don't think we need to limit calling the release callback to the special condition of one or more moves.

The order really is:

  • Mouse down
  • Zero or more (maybe thousands) of mouse moves
  • Mouse release


As for the "mouse up" this depends on where the mouse is released. You would get either:

  • Mouse up event (if on the same hotspot where the mouse down was); or
  • Cancel mouse down event (if not on the same hotspot where the mouse down was)

USA #2
That sounds great. My only issue was really that, if there's been zero moves, ReleaseCallback is no different than the mouseup/cancelmousedown callbacks. I just thought I'd bring it up, thanks for the response!