[Feature] When Tab to previous menu or press enter, select all text in search (#228), version 1.0.25.0

This commit is contained in:
Markus Hofknecht 2021-11-01 13:32:06 +01:00
parent 3ec663361f
commit bc2899708a
4 changed files with 14 additions and 17 deletions

View file

@ -256,9 +256,7 @@ namespace SystemTrayMenu.DataClasses
}
}
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 @@ namespace SystemTrayMenu.DataClasses
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);

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// 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")]

View file

@ -56,6 +56,7 @@ namespace SystemTrayMenu.UserInterface
if (Level == 0)
{
Activate();
textBoxSearch.SelectAll();
textBoxSearch.Focus();
NativeMethods.User32ShowInactiveTopmost(this);
NativeMethods.ForceForegroundWindow(Handle);
@ -63,6 +64,7 @@ namespace SystemTrayMenu.UserInterface
else
{
NativeMethods.User32ShowInactiveTopmost(this);
textBoxSearch.SelectAll();
textBoxSearch.Focus();
}
}
@ -116,11 +118,8 @@ namespace SystemTrayMenu.UserInterface
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 @@ namespace SystemTrayMenu.UserInterface
AllowDrop = true;
DragEnter += DragDropHelper.DragEnter;
DragDrop += DragDropHelper.DragDrop;
textBoxSearch.GotFocus += (sender, e) => textBoxSearch.SelectAll();
}
internal new event EventHandlerEmpty MouseWheel;
@ -222,6 +220,7 @@ namespace SystemTrayMenu.UserInterface
internal void FocusTextBox()
{
textBoxSearch.SelectAll();
textBoxSearch.Focus();
}

View file

@ -15,11 +15,11 @@ namespace SystemTrayMenu.Utilities
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)