If you use the mapping of the keyboard keys to certain functions in the configuration.exe at "General/Keys and Sounds" you use the keydown event from the keyTextBox and simply cast the e.KeyValue from the event handler to a char to use that char as the new key. This is simply wrong! This works for some keys but not for all especially not for users with a non-English keyboard layout. The value passed by KeyValue represents a hardware-key of the keyboard not the ASCII representation of the char (but "randomly" these match for the most keys of the English keyboard layout but not for many keys of foreign layouts).
The char of the key pressed is only passed by the KeyPress event. Because KeyPress is only fired for "normal" character keys and not for the F-Keys for example we can't just replace the keydown by keypress, instead we must extend it to use both events.
So simply add a seconds event handler to keyTextBox (line 491 in GeneralKeys.cs)
and add the new function which is mainly a copy of the KeyDown handler but with the correct ToString() function.
The beauty is, that by adding this event handler instead of replacing keyDown, this still works with the special keys like "F1" because in that case only the old keyDown handles the key - the new KeyPress doesn't get called.
And for the previous "wrong" keys, (e.g. the "+" sign gave with my German keyboard a "k") will now still store the "k" because keyDown still gets "falsely" called, but because KeyPress is called immediately after it the wrong value gets overwritten immediately.
It think this (or another fix) should be added to the next release because it is definitely a bug if I press the "+" on my keyboard and a "k" is shown (BTW if I just save what configure.exe made in that case neither the "K" key nor the "+" work in MediaPortal).
Hope I could help!
Greetings
Maik
The char of the key pressed is only passed by the KeyPress event. Because KeyPress is only fired for "normal" character keys and not for the F-Keys for example we can't just replace the keydown by keypress, instead we must extend it to use both events.
So simply add a seconds event handler to keyTextBox (line 491 in GeneralKeys.cs)
Code:
this.keyTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.keyTextBox_KeyPress);
Code:
private void keyTextBox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
keyTextBox.Text = e.KeyChar.ToString().ToUpper();
if (currentlySelectedNode != null)
{
if (currentlySelectedNode.Tag is KeyAction)
{
KeyAction action = currentlySelectedNode.Tag as KeyAction;
action.Key = keyTextBox.Text;
currentlySelectedNode.Nodes[1].Text = String.Format("Key = " + keyTextBox.Text);
}
}
}
The beauty is, that by adding this event handler instead of replacing keyDown, this still works with the special keys like "F1" because in that case only the old keyDown handles the key - the new KeyPress doesn't get called.
And for the previous "wrong" keys, (e.g. the "+" sign gave with my German keyboard a "k") will now still store the "k" because keyDown still gets "falsely" called, but because KeyPress is called immediately after it the wrong value gets overwritten immediately.
It think this (or another fix) should be added to the next release because it is definitely a bug if I press the "+" on my keyboard and a "k" is shown (BTW if I just save what configure.exe made in that case neither the "K" key nor the "+" work in MediaPortal).
Hope I could help!
Greetings
Maik