| View previous topic :: View next topic |
| Author |
Message |
Icfu
Joined: 24 Jul 2005 Posts: 27 Location: Rheinland
|
Posted: Sat May 27, 2006 9:28 pm Post subject: Up hotkeys destroy Down events |
|
|
Example scripts:
| Code: | LButton Up::
Beep
Click Up
Return |
| Code: | a Up::
SoundBeep
Send, {a Up}
Return |
The hotkeys fire correctly but down event is eaten.
Icfu |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1238
|
Posted: Sat May 27, 2006 9:42 pm Post subject: |
|
|
You need to define a down hotkey as well (even if it just sends the normal key):
| Code: | a::
Traytip,, a down
return
a Up::
Traytip,, a up
Return |
|
|
| Back to top |
|
 |
Icfu
Joined: 24 Jul 2005 Posts: 27 Location: Rheinland
|
Posted: Sat May 27, 2006 10:42 pm Post subject: |
|
|
| Code: | LButton Down::
Click
Return |
gives "invalid hotkey", so your workaround isn't suitable in my case unfortunately, as I try to prevent clicking the X to close an application while keeping drag&drop feature intact, that's why I need LButton Up.
The scripts were just examples to show that the problems exists with all Up events, not only mouse but also keyboard.
As I had already reported a similar problem with Up event in the past:
http://www.autohotkey.com/forum/viewtopic.php?t=4630
and it has been fixed, I hope that this one will be fixed too, including the "invalid hotkey" message when assigning a hotkey to left click I have just encountered.
Thanks for your answer
Icfu |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sat May 27, 2006 11:05 pm Post subject: |
|
|
I don't fully understand the problem, but in the Hotkeys page, I see only the Up symbol, no Down...
| AHK's manual wrote: | | The word UP may follow the name of a hotkey to cause the hotkey to fire upon release of the key rather than when the key is pressed down. | In other words, no modifier is like having the Down modifier. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Icfu
Joined: 24 Jul 2005 Posts: 27 Location: Rheinland
|
Posted: Sat May 27, 2006 11:22 pm Post subject: |
|
|
Well, it has been removed obviously. Looks like I have missed something in the changelog...
Anyway, it is not possible to create an LButton Up hotkey right now without breaking left click and drag&drop behaviour.
Open a notepad instance and run that script:
| Code: | LButton Up::
SoundBeep
;Send, {LButton Up}
Return
LButton::
Send, {LButton}
Return |
It is not possible to mark stuff in Notepad anymore, you cannot drag&drop, etc...
Something has been broken in AHK. LButton Up should work without the need to also define the "down" event.
Icfu |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1238
|
Posted: Sat May 27, 2006 11:54 pm Post subject: |
|
|
| Code: | LButton Up::
SoundBeep
Send, {LButton Up}
traytip,, up
Return
LButton::
Send, {LButton down}
traytip,, down
Return |
I think Chris intended that there would be a hotkey to catch the down event if there was one to catch the up event. I don't believe it's something that's been broken in a recent version. |
|
| Back to top |
|
 |
Icfu
Joined: 24 Jul 2005 Posts: 27 Location: Rheinland
|
Posted: Sun May 28, 2006 12:25 am Post subject: |
|
|
Thanks again, now I got it.
Looks like several stuff has changed in AHK after Click has been invented...
Unfortunately the new need for the additional down event leads to very bad side effects in some cases. The longer the script runs, the longer it needs till Click Up is fired and the longer you will have problems with "left mouse key held down" ghost effects which are hard to tolerate.
Anyway, the script I was trying to fix works now. You can check it here if you like, it minimizes Total Commander to tray when pressing X:
http://www.ghisler.ch/board/viewtopic.php?p=88652#88652
Icfu |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Mon May 29, 2006 3:58 am Post subject: |
|
|
I think you can get away with something much simpler:
~LButton up::ToolTip %A_ThisHotkey%
As far as I know, nothing major has changed about "up" hotkeys. In fact, I can't think of any changes along the lines of what's described in this topic. If you discover something that used to work in old versions but fails in the latest release (and it's not in the changelog), please let me know. |
|
| Back to top |
|
 |
Icfu
Joined: 24 Jul 2005 Posts: 27 Location: Rheinland
|
Posted: Mon May 29, 2006 10:19 am Post subject: |
|
|
| Quote: | I think you can get away with something much simpler:
~LButton up::ToolTip %A_ThisHotkey% |
Like I said, I want to PREVENT the "LButton Up" event when the user clicks the "X" to close a Total Commander window. With the "~" this won't work because "LButton Up" is sent to the "X" then, right?
This is the working code, as linked above:
| Code: | #IfWinActive, ahk_class TTOTAL_CMD
LButton Up::
WinGetPos, null, null, Width
MouseGetPos, X, Y
If (Width - X < 24 AND Width - X > 4 AND Y < 24 AND Y > 3)
WinMinimize
Click Up
Return
LButton::
Click Down
Return |
| Quote: | | If you discover something that used to work in old versions but fails in the latest release (and it's not in the changelog), please let me know. |
In former AHK versions it was possible to use "LButton Up" – notice the missing "~"! – without any nasty side effects IIRC and without the need for the addtional | Code: | LButton::
Click Down
Return | hotkey.
I suggest that you just remove the need for that, as I cannot see any reason why it makes sense to create a hotkey that tells the left mouse button to act like the left mouse button. What is it good for? Why does the Up event prevent the Down event?
Thanks for your answer
Icfu |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Tue May 30, 2006 1:07 am Post subject: |
|
|
| Icfu wrote: | | In former AHK versions it was possible to use "LButton Up" – notice the missing "~"! – without any nasty side effects IIRC | I just tested "LButton Up" on v1.0.28, which is the first version to have the "UP" keyword. It works as it does in the latest version; that is, you need a tilde to get the mouse button's click-down to perform its native function. Although it's possible that the behavior varied sometime between 1.0.28 and the present, I don't recall any changes like that.
| Quote: | | I cannot see any reason why it makes sense to create a hotkey that tells the left mouse button to act like the left mouse button. What is it good for? Why does the Up event prevent the Down event? | It's done this way because otherwise, an isolated hotkey like LButton Up would leave the mouse button stuck down. This is because the down-event would pass through to the active window but the up-event would be blocked. Of course, the script could work around this by have the LButton Up hotkey perform Click Up somewhere, but that seems more counterintuitive than the current approach (at least for typical users who don't know much about blocked vs. tilde hotkeys). However, my understanding of this topic's exact goal/benefits is still a bit cloudy; so if anyone can make a convincing case for why it should be changed or why some new keyword/feature added, please post here.
Thanks. |
|
| Back to top |
|
 |
SanskritFritz
Joined: 17 Feb 2005 Posts: 283 Location: Hungary, Budapest
|
Posted: Thu Jun 01, 2006 3:52 pm Post subject: |
|
|
I, as a tipical user, want to prevent (for whatever reason) the up event, and let only the down event pass through. When I realize, that i cannont click anymore (no down events are coming at all), i am slighly puzzled. So at first glance i would classify this as a bug. Question is, how would windows handle the down events without receiving up events? _________________ Is there another word for synonym? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri Jun 02, 2006 2:20 am Post subject: |
|
|
| SanskritFritz wrote: | | how would windows handle the down events without receiving up events? | The mouse button would stay in a logically down position, which means that every application (or at least the active window) would see that you're permanently trying to drag something. In addition, any application that queried the state of the button (by means such as GetKeyState) would see it as stuck down.
Part of the reason the feature was designed this way was the concern that doing it the other way would result in many malfunctioning scripts where keys and buttons would become stuck down, which in turn would generate many posts and e-mails about how to solve the problem. Many users don't understand what to do when a button or key becomes stuck down; some of them even resort to rebooting or even turning off their PC (there have been a few posts where people have mentioned they had to do that -- they didn't realize that all they had to do was press the key once to get it to become unstuck).
Furthermore, the need to allow the click-down to pass through but block the click-up seems rare. After all, most actions occur upon click-down vs. click-up (I realize there are exceptions like title bar buttons, which are central to this topic).
If you still have a need for such a feature and see no other way to achieve the goal, perhaps a new type of hotkey can be added. However, explaining or demonstrating how such a feature would be useful to more than 1% of users would help justify it and set its priority.
More comments are welcome from anyone. |
|
| Back to top |
|
 |
|