Cancel hotkey rebind on Esc key press
This commit is contained in:
committed by
teinarss
parent
889e2152a4
commit
47f6e407d9
@@ -1060,6 +1060,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
hotkeyEntryWidget = panel.Get<HotkeyEntryWidget>("HOTKEY_ENTRY");
|
||||
hotkeyEntryWidget.IsValid = () => isHotkeyValid;
|
||||
hotkeyEntryWidget.OnLoseFocus = ValidateHotkey;
|
||||
hotkeyEntryWidget.OnEscKey = () =>
|
||||
{
|
||||
hotkeyEntryWidget.Key = modData.Hotkeys[selectedHotkeyDefinition.Name].GetValue();
|
||||
};
|
||||
}
|
||||
|
||||
void ValidateHotkey()
|
||||
@@ -1070,6 +1074,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
if (isHotkeyValid)
|
||||
SaveHotkey();
|
||||
else
|
||||
hotkeyEntryWidget.TakeKeyboardFocus();
|
||||
}
|
||||
|
||||
void SaveHotkey()
|
||||
|
||||
Reference in New Issue
Block a user