AutoHotkey Community

It is currently May 27th, 2012, 7:19 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: May 27th, 2006, 9:28 pm 
Offline

Joined: July 24th, 2005, 4:29 am
Posts: 27
Location: Rheinland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2006, 9:42 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2006, 10:42 pm 
Offline

Joined: July 24th, 2005, 4:29 am
Posts: 27
Location: Rheinland
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/viewtop ... highlight=

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2006, 11:05 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2006, 11:22 pm 
Offline

Joined: July 24th, 2005, 4:29 am
Posts: 27
Location: Rheinland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2006, 11:54 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 28th, 2006, 12:25 am 
Offline

Joined: July 24th, 2005, 4:29 am
Posts: 27
Location: Rheinland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 29th, 2006, 3:58 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 29th, 2006, 10:19 am 
Offline

Joined: July 24th, 2005, 4:29 am
Posts: 27
Location: Rheinland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 30th, 2006, 1:07 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2006, 3:52 pm 
Offline

Joined: February 17th, 2005, 10:06 am
Posts: 280
Location: Hungary, Budapest
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 2nd, 2006, 2:20 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group