Help with mouse gestures

Get help with using AutoHotkey and its commands and hotkeys
Pilou42
Posts: 5
Joined: 18 Oct 2017, 17:03

Help with mouse gestures

19 Oct 2017, 11:50

Hello,

I'm trying to write a basic mouse gestures with wheel support, and as a beginner, I don't manager to find the right way to do it.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


This code works, but I have the feeling it is not correct. Sometimes the contextual menu does not appear outside of window.
Plus when I try to integrate mousewheel support, I cannot, since GetKeyState, PLR2, RButton always result in "U" state.
I've tried to read some mouse gestures scripts but they are too complicated for me.

What is the best way to do stuff when Rbutton is down ? And when RButton is up, I'd like either it fires the normal contextual menu, either it fires another event without breaking right click (like if RButton got stuck in "D" state).

If someone can give me some clues, I'd really like to understand it.
Last edited by Pilou42 on 20 Oct 2017, 13:02, edited 1 time in total.
GEV
Posts: 621
Joined: 25 Feb 2014, 00:50

Re: Help with mouse gestures

19 Oct 2017, 13:19

Try

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Pilou42
Posts: 5
Joined: 18 Oct 2017, 17:03

Re: Help with mouse gestures

19 Oct 2017, 13:57

Thanks for this code, I'll try to study this KeyWait function.
Unfortunately, the "Esc" key to remove context menu is not what I desire. I'd really like to tell system the "U" state of Rbutton without triggering {Rbutton Up} (and then no contextual menu or whatever).
GEV
Posts: 621
Joined: 25 Feb 2014, 00:50

Re: Help with mouse gestures

19 Oct 2017, 16:01

What about this

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by GEV on 20 Oct 2017, 01:36, edited 2 times in total.
Pilou42
Posts: 5
Joined: 18 Oct 2017, 17:03

Re: Help with mouse gestures

19 Oct 2017, 19:14

I think I understood the logic, but the contextual menu does not work as it should with this solution:
1) contextual menu does not work on toolbar
2) if I do 5 right click at 5 different positions, contextual menu is shown only at the first position. Without script, you'll have 5 contextual menus, at 5 different positions.
GEV
Posts: 621
Joined: 25 Feb 2014, 00:50

Re: Help with mouse gestures

20 Oct 2017, 01:28

I edited my last answer. Try it again.
Pilou42
Posts: 5
Joined: 18 Oct 2017, 17:03

Re: Help with mouse gestures

20 Oct 2017, 12:59

It works indeed. So many little thing to understand. ~* for example (I did not know it could be combined). But I'll try to read more and to really understand both.
If you're still motivated, Is there an easy way to add wheel gestures, like KeyWait, Wheeldown and KeyWait, Wheelup ?
No problem if you don't want. I'll try with what you taught me.
Pilou42
Posts: 5
Joined: 18 Oct 2017, 17:03

Re: Help with mouse gestures

21 Oct 2017, 11:56

Finally, I understood the complete logic. The thing I was not able to understand is the fact when you want to deal with Rbutton (right click), you must NOT send Rbutton down, or else you won't be able to avoid contextual menu, since for each Rbutton Down you need a Rbutton Up or OS goes crazy (since waiting for his Rbutton Up). You'll send Rbutton per cases.
Unfortunately, if you don't send Rbutton Down, it means Rbutton state is always Up, that's why you need to use a variable to replace GetKeyState ("RighClickDown" in my case).

Thanks GEV for your help !

Here is the final script of what I wanted:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


I'm still concerned by CPU resources with mouse binds especially with wheel. If somebody has something which is more CPU optimized, I'm interested.

Return to “Ask For Help”

Who is online

Users browsing this forum: A_User, Hellbent, kczx3, makoto, Osprey and 50 guests