Menu: Never treat keys with no "Char" as hotkeys.

This commit is contained in:
svdijk 2017-05-18 20:44:15 +02:00 committed by Christoph Oelckers
parent 4b8f4212ef
commit 8ece6dff6a
2 changed files with 3 additions and 3 deletions

View File

@ -106,11 +106,11 @@ class ListMenu : Menu
override bool OnUIEvent(UIEvent ev) override bool OnUIEvent(UIEvent ev)
{ {
if (ev.Type == UIEvent.Type_KeyDown) if (ev.Type == UIEvent.Type_KeyDown && ev.KeyChar > 0)
{ {
// tolower // tolower
int ch = ev.KeyChar; int ch = ev.KeyChar;
ch = ch >= 65 && ch <91? ch + 32 : ch; ch = ch >= 65 && ch < 91 ? ch + 32 : ch;
for(int i = mDesc.mSelectedItem + 1; i < mDesc.mItems.Size(); i++) for(int i = mDesc.mSelectedItem + 1; i < mDesc.mItems.Size(); i++)
{ {

View File

@ -199,7 +199,7 @@ class ListMenuItemSelectable : ListMenuItem
override bool CheckHotkey(int c) override bool CheckHotkey(int c)
{ {
return c == mHotkey; return c > 0 && c == mHotkey;
} }
override bool Activate() override bool Activate()