From bc2899708a222a1c85e7b230f91328edd5c9a061 Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Mon, 1 Nov 2021 13:32:06 +0100 Subject: [PATCH] [Feature] When Tab to previous menu or press enter, select all text in search (#228), version 1.0.25.0 --- DataClasses/RowData.cs | 6 ++---- Properties/AssemblyInfo.cs | 4 ++-- UserInterface/Menu.cs | 11 +++++------ Utilities/File/FileIni.cs | 10 +++++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/DataClasses/RowData.cs b/DataClasses/RowData.cs index a0b298f2..298024b3 100644 --- a/DataClasses/RowData.cs +++ b/DataClasses/RowData.cs @@ -256,9 +256,7 @@ private void OpenItem(MouseEventArgs e, ref bool toCloseByOpenItem) } } - private bool SetLnk( - ref bool isLnkDirectory, - ref string resolvedLnkPath) + private bool SetLnk(ref bool isLnkDirectory, ref string resolvedLnkPath) { bool handled = false; resolvedLnkPath = FileLnk.GetResolvedFileName(TargetFilePath); @@ -306,7 +304,7 @@ private bool SetUrl() handled = true; } } - else if (System.IO.File.Exists(iconFile)) + else if (File.Exists(iconFile)) { FilePathIcon = iconFile; icon = IconReader.GetFileIconWithCache(FilePathIcon, true, true, out bool loading); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 4c4d2d0d..03654293 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -39,5 +39,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.24.4")] -[assembly: AssemblyFileVersion("1.0.24.4")] +[assembly: AssemblyVersion("1.0.25.0")] +[assembly: AssemblyFileVersion("1.0.25.0")] diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index a509f338..a3cb8b08 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -56,6 +56,7 @@ void Fading_Show() if (Level == 0) { Activate(); + textBoxSearch.SelectAll(); textBoxSearch.Focus(); NativeMethods.User32ShowInactiveTopmost(this); NativeMethods.ForceForegroundWindow(Handle); @@ -63,6 +64,7 @@ void Fading_Show() else { NativeMethods.User32ShowInactiveTopmost(this); + textBoxSearch.SelectAll(); textBoxSearch.Focus(); } } @@ -116,11 +118,8 @@ void Fading_Show() BackColor = backColor, }; - customScrollbar.GotFocus += CustomScrollbar_GotFocus; - void CustomScrollbar_GotFocus(object sender, EventArgs e) - { - textBoxSearch.Focus(); - } + dgv.GotFocus += (sender, e) => FocusTextBox(); + customScrollbar.GotFocus += (sender, e) => FocusTextBox(); customScrollbar.Margin = new Padding(0); customScrollbar.Scroll += CustomScrollbar_Scroll; @@ -170,7 +169,6 @@ void ControlsMouseLeave(object sender, EventArgs e) AllowDrop = true; DragEnter += DragDropHelper.DragEnter; DragDrop += DragDropHelper.DragDrop; - textBoxSearch.GotFocus += (sender, e) => textBoxSearch.SelectAll(); } internal new event EventHandlerEmpty MouseWheel; @@ -222,6 +220,7 @@ protected override CreateParams CreateParams internal void FocusTextBox() { + textBoxSearch.SelectAll(); textBoxSearch.Focus(); } diff --git a/Utilities/File/FileIni.cs b/Utilities/File/FileIni.cs index a8167de3..c93d51de 100644 --- a/Utilities/File/FileIni.cs +++ b/Utilities/File/FileIni.cs @@ -15,11 +15,11 @@ public class FileIni public FileIni(string path) { values = File.ReadLines(path) - .Where(line => !string.IsNullOrWhiteSpace(line) && - !line.StartsWith("#", System.StringComparison.InvariantCulture)) - .Select(line => line.Split(new char[] { '=' }, 2, 0)) - .ToDictionary(parts => parts[0].Trim(), parts => - parts.Length > 1 ? parts[1].Trim() : null); + .Where(line => !string.IsNullOrWhiteSpace(line) && + !line.StartsWith("#", System.StringComparison.InvariantCulture)) + .Select(line => line.Split(new char[] { '=' }, 2, 0)) + .ToDictionary(parts => parts[0].Trim(), parts => + parts.Length > 1 ? parts[1].Trim() : null); } public string Value(string name, string value = null)