AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"Lbutton up" in Gui gLabel calls first hotkey

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sat Aug 09, 2008 3:30 pm    Post subject: "Lbutton up" in Gui gLabel calls first hotkey Reply with quote

If a hotkey "Lbutton up" is placed in a label routine of Gui, then another hotkey routine is called first.
Namely the first defined hotkey routine in the script, in this case FirstHotkey.
This behaviour doesn't look normal to me. Can somebody explain this?
Code:
   ; (Tested with 1.0.47.00 and 1.0.47.06 on WindowsXP)
   Gui, add, text, gtxtLbutton, Click on this text (Ahk V%A_AhkVersion%).
   Gui, show, x300 y500 w250, Lbutton up in gLabel
   ; Hotkey, LButton up, LButtonUp    ; this doesn't cause other hotkey call
   Hotkey, F9, FirstHotkey
   Hotkey, F10, AnotherHotkey
   ; F9::         ; same effect as "Hotkey, F9, FirstHotkey"
   ;    Msgbox,,,%A_thisHotkey% pressed!,
   ; return
return
FirstHotkey:
AnotherHotkey:
   Msgbox,,,%A_thisLabel% called!,
return
txtLbutton:
    Hotkey, LButton up, LButtonUp    ; another hotkey then "LButton up" is no problem
    ; But if "LButton up", it causes to call FirstHotkey routine first
return
LButtonUp:
   Hotkey, LButton up, off
   Msgbox %A_thisLabel% (LButton up off)
return
GuiClose:
   ExitApp
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 970
Location: London, UK

PostPosted: Sat Aug 09, 2008 5:06 pm    Post subject: Reply with quote

Seems to be an obscure bug, It does eaxtly the same for me.

Slight work around.
Code:
  ; (Tested with 1.0.47.00 and 1.0.47.06 on WindowsXP)
   Gui, add, text, gtxtLbutton, Click on this text (Ahk V%A_AhkVersion%).
   Gui, show, x300 y500 w250, Lbutton up in gLabel
   ; Hotkey, LButton up, LButtonUp    ; this doesn't cause other hotkey call
   Hotkey,F5,FirstHotkey
   Hotkey,F6,AnotherHotkey
   ; F9::         ; same effect as "Hotkey, F9, FirstHotkey"
   ;    Msgbox,,,%A_thisHotkey% pressed!,
   ; return

return

LButtonUp:
   Hotkey, LButton up, off
   Msgbox %A_thisLabel% (LButton up off)
return

AnotherHotkey:
FirstHotkey:
Msgbox,,,%A_thisLabel% called!,
Return

txtLbutton:
    keywait,LButton,t0.5
    Hotkey, LButton up, LButtonUp,On
    ; another hotkey then "LButton up" is no problem
    ; But if "LButton up", it causes to call FirstHotkey routine first
return


GuiClose:
   ExitApp

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sat Aug 09, 2008 5:25 pm    Post subject: Reply with quote

Superfraggle wrote:
Slight work around.
Thanks for your workaround.
But if you hold down Lbutton longer then the delay, it gives the same result.
And if you don't hold it down, it doesn't respond to "Lbutton up". You have to click it twice.
After all it seems a bug to me as well, but it seems so weird, i thought there is maybe an explanation for it.
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 970
Location: London, UK

PostPosted: Sat Aug 09, 2008 6:41 pm    Post subject: Reply with quote

I think Lexicos or Chris maybe able to explain what is going on.

Just out of interest I guess you are trying to get a label to fire when the left button is release upon that control, in which case a solution could be worked using onmessage.
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sat Aug 09, 2008 10:20 pm    Post subject: Reply with quote

Superfraggle wrote:
Just out of interest I guess you are trying to get a label to fire when the left button is release upon that control, in which case a solution could be worked using onmessage.
What I'm doing with my other script is, when clicking the control, I'm able to drag another Gui window, and then I want to detect when the user stopped dragging that other Gui window. So I thought first about the "LButton up" hotkey.
I checked before a bit with OnMessage, but not much success. Confused I checked again now with WinSpector, but no result to catch a message in AHK.
Anyway, I'm getting a bit off my topic now Smile .
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 970
Location: London, UK

PostPosted: Sat Aug 09, 2008 11:43 pm    Post subject: Reply with quote

Something like this then.

Code:
Onmessage(0x202,"wm_mouseup")

  ; (Tested with 1.0.47.00 and 1.0.47.06 on WindowsXP)
   Gui, add, text, gtxtLbutton vdragbutton, Click on this text (Ahk V%A_AhkVersion%).
   Gui, show, x300 y500 w250, Lbutton up in gLabel
   ; Hotkey, LButton up, LButtonUp    ; this doesn't cause other hotkey call
   Hotkey,F5,FirstHotkey
   Hotkey,F6,AnotherHotkey
   ; F9::         ; same effect as "Hotkey, F9, FirstHotkey"
   ;    Msgbox,,,%A_thisHotkey% pressed!,
   ; return

return

LButtonUp:
   Msgbox %A_thisLabel% (LButton up off)
return

AnotherHotkey:
FirstHotkey:
Msgbox,,,%A_thisLabel% called!,
Return

txtLbutton:
 
return


GuiClose:
   ExitApp

wm_mouseup(wparam,Lparam,msg,hwnd){
    If (a_guicontrol = "dragbutton"){
        Gosub,LButtonUp
    }
    Return
}

_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
Peter



Joined: 30 Dec 2005
Posts: 279

PostPosted: Sun Aug 10, 2008 7:54 am    Post subject: Reply with quote

Thanks for your effort, but that's no solution for me (tried already before).
I think you got a solution if you can detect when you stopped dragging a window (i.e. also LButton up, but when dragging).
PS: Also without "If (a_guicontrol = "dragbutton")" is this not a solution. But maybe I try to avoid it, by another solution for my problem.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group