[BUG] search text cut off (#362), version 1.2.8.6

This commit is contained in:
Markus Hofknecht 2022-02-20 18:00:04 +01:00
parent a8643b00b1
commit 49eac15a87
2 changed files with 20 additions and 12 deletions

View file

@ -253,12 +253,8 @@ namespace SystemTrayMenu.Business
menuData.RowDataParent.SubMenu = menu;
if (menus[0].IsUsable)
{
if (!string.IsNullOrEmpty(userSearchText))
{
menu.SetSearchText(userSearchText);
}
ShowSubMenu(menu);
menu.SetSearchText(userSearchText);
}
}
else if (closedLoadingMenu && menus[0].IsUsable)

View file

@ -24,6 +24,7 @@ namespace SystemTrayMenu.UserInterface
private int rotationAngle;
private bool mouseDown;
private Point lastLocation;
private bool isSetSearchText;
internal Menu()
{
@ -59,16 +60,12 @@ namespace SystemTrayMenu.UserInterface
if (Level == 0)
{
Activate();
textBoxSearch.SelectAll();
textBoxSearch.Focus();
NativeMethods.User32ShowInactiveTopmost(this);
NativeMethods.ForceForegroundWindow(Handle);
}
else
{
NativeMethods.User32ShowInactiveTopmost(this);
textBoxSearch.SelectAll();
textBoxSearch.Focus();
}
}
}
@ -234,8 +231,19 @@ namespace SystemTrayMenu.UserInterface
internal void FocusTextBox()
{
textBoxSearch.SelectAll();
textBoxSearch.Focus();
if (isSetSearchText)
{
isSetSearchText = false;
textBoxSearch.SelectAll();
textBoxSearch.Focus();
textBoxSearch.SelectionStart = textBoxSearch.Text.Length;
textBoxSearch.SelectionLength = 0;
}
else
{
textBoxSearch.SelectAll();
textBoxSearch.Focus();
}
}
internal void SetTypeSub()
@ -313,7 +321,11 @@ namespace SystemTrayMenu.UserInterface
internal void SetSearchText(string userSearchText)
{
textBoxSearch.Text = userSearchText;
if (!string.IsNullOrEmpty(userSearchText))
{
textBoxSearch.Text = userSearchText + "*";
isSetSearchText = true;
}
}
internal bool IsMouseOn(Point mousePosition)