From 3c1e7896a5e46fd205caa5803cc7423ae1e6bcb8 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 2 Sep 2017 09:40:08 +0100 Subject: [PATCH] Clear editor search fields and yield focus on escape. --- .../Widgets/Logic/Editor/ActorSelectorLogic.cs | 7 +++++++ .../Widgets/Logic/Editor/TileSelectorLogic.cs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs index 392fa2372f..b2771c3997 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/ActorSelectorLogic.cs @@ -165,6 +165,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic InitializeActorPreviews(); }; + searchTextField.OnEscKey = () => + { + searchTextField.Text = ""; + searchTextField.YieldKeyboardFocus(); + return true; + }; + var actorCategorySelector = widget.Get("CATEGORIES_DROPDOWN"); actorCategorySelector.GetText = () => { diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs index 94fc44fd54..5af2f04643 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/TileSelectorLogic.cs @@ -73,6 +73,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic InitializeTilePreview(); }; + searchTextField.OnEscKey = () => + { + searchTextField.Text = ""; + searchTextField.YieldKeyboardFocus(); + return true; + }; + Func categoryTitle = s => s != null ? s : "Search Results"; Func setupItem = (option, template) => {