Hook escape key to clear search filter
This commit is contained in:
parent
18c4357057
commit
81f4786d27
4 changed files with 25 additions and 1 deletions
|
|
@ -83,6 +83,15 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
this.ClearSearch();
|
||||
};
|
||||
|
||||
searchBox.KeyDown += (s, e) =>
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
this.ClearSearch();
|
||||
e.Handled = true;
|
||||
}
|
||||
};
|
||||
|
||||
searchBox.searchInput.ActualTextEditWidget.TextChanged += (s, e) =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(searchBox.Text))
|
||||
|
|
@ -163,6 +172,8 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
searchBox.Text = "";
|
||||
searchBox.ResetButton.Visible = false;
|
||||
treeView.SelectedNode = null;
|
||||
|
||||
this.OnClearSearch();
|
||||
}
|
||||
|
||||
protected abstract bool FilterTree(TreeNode context, string filter, bool parentVisible, List<TreeNode> matches);
|
||||
|
|
@ -178,6 +189,10 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
|||
}
|
||||
}
|
||||
|
||||
protected virtual void OnClearSearch()
|
||||
{
|
||||
}
|
||||
|
||||
public bool TreeLoaded { get; protected set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void SystemWindow_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
if (e.KeyCode == Keys.Escape
|
||||
&& !e.Handled)
|
||||
{
|
||||
this.OnCancel(out bool abortCancel);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PartPreviewWindow;
|
||||
|
|
@ -45,6 +46,7 @@ namespace MatterHackers.MatterControl
|
|||
this.headerRow.Visible = false;
|
||||
|
||||
contentRow.Padding = 0;
|
||||
contentRow.BackgroundColor = Color.Transparent;
|
||||
|
||||
contentRow.AddChild(new HelpTreePanel(theme, guideKey)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -91,6 +91,12 @@ namespace MatterHackers.MatterControl
|
|||
return hasMatch;
|
||||
}
|
||||
|
||||
protected override void OnClearSearch()
|
||||
{
|
||||
rootNode.Expanded = true;
|
||||
base.OnClearSearch();
|
||||
}
|
||||
|
||||
private void CreateKeyBindingsPage()
|
||||
{
|
||||
double left, right;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue