[GUI] Hotkey-Control: Incorrect displaying in some cases

Report problems with documented functionality
User avatar
SAPlayer
Posts: 48
Joined: 30 Sep 2013, 13:38
Location: Germany
Contact:

[GUI] Hotkey-Control: Incorrect displaying in some cases

27 Dec 2013, 15:34

Try this script:

Code: Select all

Gui, Add, Hotkey, vHotkey1, -
Gui, Add, Hotkey, vHotkey2, +
Gui, Add, Hotkey, vHotkey3, NumpadAdd
Gui, Add, Hotkey, vHotkey4, NumpadMult
Gui, Add, Hotkey, vHotkey5, NumpadDiv
Gui, Add, Hotkey, vHotkey6, *
Gui, Add, Button, gCheck, Check
Gui, Show
return

Check:
msg := ""
loop
{
	GuiControlGet, current,, Hotkey%A_Index%
	if(ErrorLevel)
		break
	msg .= A_Index ": " current "`n"
}
MsgBox, % msg
return

GuiClose:
ExitApp
Result:
Some keys are displayed correctly, some are displayed with a wrong displaying and some are not displayed at all.
When you press check, you'll get the contents of each control. Some of they are wrong.

Further steps:
Try to enter + manually into the second field. It's correctly displayed and read when you "Check" it.


Everything tested on a german Windows 8.1 system with german keyboard layout.
AHK: 1.1.13.01
Attachments
Unbenannt.png
Output on my german system.
just me
Posts: 9487
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [GUI] Hotkey-Control: Incorrect displaying in some cases

27 Dec 2013, 16:10

The Help File wrote:By default, the control starts off with no hotkey specified. To instead have a default, specify its modifiers and name as the last parameter as in this example: Gui, Add, Hotkey, vChosenHotkey, ^!p
The only modifiers supported are ^ (Control), ! (Alt), and + (Shift). See the key list for available key names.

Code: Select all

+ = modifier 'Shift' without a key name
* = shifted key '+'
User avatar
SAPlayer
Posts: 48
Joined: 30 Sep 2013, 13:38
Location: Germany
Contact:

Re: [GUI] Hotkey-Control: Incorrect displaying in some cases

27 Dec 2013, 16:17

I know, see my script, there are defaults set, but sometimes they are not properly displayed.

But when I type `+` manually into the control, it's properly displayed.
And it's a valid hotkey with the Hotkey-command.
just me
Posts: 9487
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: [GUI] Hotkey-Control: Incorrect displaying in some cases

28 Dec 2013, 04:01

Some of the issues are 'home made'. You cannot pass a single '+' as a default value for a hotkey control, because it will be used as the modifier key 'shift'. Also, you cannot pass a single '*', because '*' is 'UMSCHALT + +' on German keyboard layouts, but this could be solved by passing '+*'.

In contrast, the issues with the numpad keys seem to be caused by the German Windows' version. I get the same results on Win 7. Just try

Code: Select all

#NoEnv
Key := "NumPadDiv"
MsgBox, % GetKeyNameText(Key)
ExitApp

GetKeyNameText(Key, Extended := False, DoNotCare := False) {
   ; http://msdn.microsoft.com/en-us/library/windows/desktop/ms646300(v=vs.85).aspx
   SC := GetKeySC(Key)
   DoNotCare := !!DoNotCare
   Extended := !!Extended
   Param := (SC << 16) | (Extended << 24) | (DoNotCare << 25)
   VarSetCapacity(KeyName, 64, 0)
   DllCall("User32.dll\GetKeyNameText", "Int", Param, "Str", KeyName, "Int", 32)
   Return KeyName
}
and switch the user's locale between 'DE' and 'EN' to see the difference.

BTW: When a first looked at the MSDN documentation of the hotkey control, my instant impression was to look at an early stage prototype, not a complete control. Three messages, no styles, a handful of constants, that's all. I believe that Microsoft actually does not really love it.
User avatar
SAPlayer
Posts: 48
Joined: 30 Sep 2013, 13:38
Location: Germany
Contact:

Re: [GUI] Hotkey-Control: Incorrect displaying in some cases

28 Dec 2013, 09:56

Hm, I see.
Is there any way to avoid this bug (workaround)?

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 28 guests