ToolStatus: Add searchbox keybind for returning focus to treelist (fixes
@@ -669,6 +669,34 @@ LRESULT CALLBACK MainWndSubclassProc(
{
// handle keybind Ctrl + K
if (SearchboxHandle && ToolStatusConfig.SearchBoxEnabled)
+ {
+ // Check if the searchbox is already focused.
+ if (GetFocus() == SearchboxHandle)
+ {
+ HWND tnHandle;
+
+ // Return focus to the treelist.
+ if (tnHandle = GetCurrentTreeNewHandle())
+ {
+ ULONG tnCount = TreeNew_GetFlatNodeCount(tnHandle);
+
+ for (ULONG i = 0; i < tnCount; i++)
+ {
+ PPH_TREENEW_NODE node = TreeNew_GetFlatNode(tnHandle, i);
+
+ // Select the first visible node.
+ if (node->Visible)
+ {
+ SetFocus(tnHandle);
+ TreeNew_SetFocusNode(tnHandle, node);
+ TreeNew_SetMarkNode(tnHandle, node);
+ TreeNew_SelectRange(tnHandle, i, i);
+ break;
+ }
+ }
+ }
+ }
+ else
{
if (SearchBoxDisplayMode == SEARCHBOX_DISPLAY_MODE_HIDEINACTIVE)
{
@@ -683,6 +711,7 @@ LRESULT CALLBACK MainWndSubclassProc(
Edit_SetSel(SearchboxHandle, 0, -1);
}
}
+ }
goto DefaultWndProc;
case PHAPP_ID_VIEW_ALWAYSONTOP:
{
