Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Miniwindows ➜ DragRelease handler always executed after releasing the mouse button?

DragRelease handler always executed after releasing the mouse button?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Twisol   USA  (2,257 posts)  Bio
Date Tue 29 Dec 2009 08:55 PM (UTC)

Amended on Tue 29 Dec 2009 08:56 PM (UTC) by Twisol

Message
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...

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 30 Dec 2009 03:30 AM (UTC)
Message
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)


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #2 on Wed 30 Dec 2009 03:41 AM (UTC)
Message
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!

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


9,508 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.