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
➜ click vs doubleclick in hotspots
click vs doubleclick in hotspots
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Zimmy
(31 posts) Bio
|
Date
| Tue 05 Nov 2019 03:29 AM (UTC) |
Message
| I would like to have two completely different things happen depending on whether I right-click or double-click on a hotspot. The problem I'm having now is that if I double-click then the single-click will still activate first. How would I make it so that if I double-click the sing-click event doesn't happen first? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 05 Nov 2019 04:47 AM (UTC) |
Message
| Can you clarify two things?
Are you doing two completely different things on double-click compared to single-click? Typically in many applications (eg. Windows desktop) a single click selects, and a double-click opens. Thus the single click is not incompatible with the (following) second click.
Are you performing the action on mouse-down or the subsequent mouse-up? Typically actions are performed on a mouse-up.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zimmy
(31 posts) Bio
|
Date
| Reply #2 on Tue 05 Nov 2019 04:54 AM (UTC) |
Message
| I was just using mousedown. Basically I have a little map and I want to make it so that if I single click I look at a room and if I double click I actually move to it. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 05 Nov 2019 07:19 AM (UTC) |
Message
| First, most programs react to a mouse-up to do an action rather than a mouse-down.
This lets you change your mind if you inadvertently click on the wrong room, for example. You can move the mouse away to some neutral spot and then release the mouse.
You will probably find it more like normal behaviour to implement your actions on mouse-up.
Now what you can do is "remember" when the mouse-down occurred, and then see how long elapsed between the mouse-down and the next mouse-up. That way you could make a short press be look at the room contents, and press and hold for half a second be move to that room. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zimmy
(31 posts) Bio
|
Date
| Reply #4 on Tue 05 Nov 2019 08:03 AM (UTC) |
Message
| Thanks, I guess I could also have single click work on a delay that gets canceled if double-click happens first. However, I didn't want to sacrifice speed so I ended up just switching to right/left click. I also, switched to mouseup, thanks for pointing that out! | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Wed 06 Nov 2019 12:03 AM (UTC) |
Message
| In my mapper I think I had LH click to move and RH click for more information about the room. You can also add Ctrl/Shift/Alt to both LH and RH clicks, so that is 6 different combinations right there!
Your idea of the delayed single-click action is also something I was going to suggest. You could make a temporary timer to show something after 0.7 seconds, and cancel it if you get a double-click after 0.5 seconds.
Another option (on the mouse-up) is to use the WindowMenu to pop up a small menu on a RH click, eg.
Alternatively show the menu on a mouse-up if more than (say) 0.5 seconds have elapsed. So, a short click (down/up) will move you to the room, and a longer click shows the menu, and you choose what to do. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
16,529 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top