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 

Problems with key name synonyms (Ex: Delete and Del)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
jballi



Joined: 01 Oct 2005
Posts: 319
Location: Texas, USA

PostPosted: Tue Dec 11, 2007 5:29 am    Post subject: Problems with key name synonyms (Ex: Delete and Del) Reply with quote

v1.0.47.05

Key names with synonyms (Ex: Delete/Del, Insert/Ins, Enter/Return, etc.) are not treated as the same key when used as context-sensitive hotkeys in multiple context wrappers (hotkeys for multiple GUIs for example).

I created this script as an example.

Code:
#SingleInstance force
gui 23:add,button,w200 h100 gGUI1,GUI1
gui 23:add,button,w200 h100 gGUI2,GUI2
gui 23:show,, PrimaryGUI
return

23guiclose:
ExitApp


;------------------ GUI1
GUI1:
gui 1:-MinimizeBox
gui 1:add,Text,w250 h100,
   (ltrim join`s
    Press Enter, Escape, Backspace, Delete, or Insert to trigger
    the associated hotkey.  Note that not all of the hotkeys
    work on this GUI.
   )
gui 1:show,,GUI1
return

guiclose:
gui 1:Destroy
return

#IfWinActive GUI1
Enter::
Escape::
Backspace::
Delete::
Insert::
gui 1:+OwnDialogs
msgbox %A_ThisHotkey% button pressed for GUI1.
return
#IfWinActive


;------------------ GUI2
GUI2:
gui 2:-MinimizeBox
gui 2:add,Text,w250 h100,
   (ltrim join`s
    Press Enter, Escape, Backspace, Delete, or Insert to trigger
    the associated hotkey.  Note that not all of the hotkeys
    work on this GUI.
   )
gui 2:show,,GUI2
return

2guiclose:
gui 2:Destroy
return

#IfWinActive GUI2
Return::
Esc::
BS::
Del::
Ins::
gui 2:+OwnDialogs
msgbox %A_ThisHotkey% button pressed for GUI2.
return
#IfWinActive

Note that some of the hotkeys will fire in GUI1 and other hotkeys will fire in GUI2.

In this example, all the hotkeys for a GUI will fire if 1) all the hotkey synonyms are renamed to either the long name or the short name (it doesn't matter which one) or if 2) one of the context wrappers is commented out. For example, all of the hotkeys for GUI1 will work if the context hotkeys for GUI2 are commented out.

Thank you for your attention. Let me know if you need any additional information.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Feb 29, 2008 3:09 am    Post subject: Reply with quote

Sorry for the late reply.

Thanks for pointing this out. It's definitely undesirable behavior.

Unfortunately the current architecture doesn't provide any easy way to fix this. So until I or someone else does finally fix it, it has been documented as a known limitation:
Quote:
When creating duplicate hotkeys, the order of modifier symbols such as ^!+# does not matter. For example, ^!c is the same as !^c. However, keys must be spelled consistently. For example, Esc is not the same as Escape for this purpose. Finally, any hotkey with a wildcard prefix (*) is entirely separate from a non-wildcard one; for example, *F1 and F1 would each have their own set of variants.

Sorry for the trouble it caused.
Back to top
View user's profile Send private message Send e-mail
jballi



Joined: 01 Oct 2005
Posts: 319
Location: Texas, USA

PostPosted: Fri Feb 29, 2008 12:23 pm    Post subject: Reply with quote

Chris wrote:
Unfortunately the current architecture doesn't provide any easy way to fix this. So until I or someone else does finally fix it, it has been documented as a known limitation.

Thanks for the feedback.

I noticed this bug when I was trying to include code that contained hotkey definitions. I must have hit one of the non-working hotkeys 10 times before I accepted that it probably wasn't going to work.

Until this bug is fixed, I would recommend to anyone who uses keys that have alternate definitions (Ex: Backspace and BS) to consistently choose one or the other. I would recommend selecting the full or expanded definition (Backspace) rather than the short or abbreviated version (BS) because the short version is not always easily interpreted. After all, everyone knows that "BS" stands for "Balance Sheet". The Enter and Return keys are a bit tougher to choose from but I like Enter because that's what is written on my keyboard.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports 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