From 8342da3df8009f8d76d1d4990f3b5695eae88dd8 Mon Sep 17 00:00:00 2001 From: AngryGamer Date: Fri, 21 Jul 2017 19:24:52 -0700 Subject: [PATCH] Fix multi-line tab button stay pushed issue while swiching off. Make sure previous tab does not keep focus when switching tabs. TO REPRODUCE: Step 1: Move a tab using drag and drop. Step 2: Use a tab switching hotkey/feature which doesn't set TCM_SETCURFOCUS AND TCM_SETCURSEL Fixes #3545, closes #3552 --- PowerEditor/src/WinControls/TabBar/TabBar.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index df6e2e28a..4bcecd6f3 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -152,7 +152,15 @@ void TabBar::setFont(TCHAR *fontName, int fontSize) void TabBar::activateAt(int index) const { if (getCurrentTabIndex() != index) + { + // TCS_BUTTONS needs both set or two tabs can appear selected + if (::GetWindowLongPtr(_hSelf, GWL_STYLE) & TCS_BUTTONS) + { + ::SendMessage(_hSelf, TCM_SETCURFOCUS, index, 0); + } + ::SendMessage(_hSelf, TCM_SETCURSEL, index, 0); + } TBHDR nmhdr; nmhdr._hdr.hwndFrom = _hSelf;