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
This commit is contained in:
AngryGamer 2017-07-21 19:24:52 -07:00 committed by Don HO
parent 194376d6d7
commit 8342da3df8

View File

@ -152,7 +152,15 @@ void TabBar::setFont(TCHAR *fontName, int fontSize)
void TabBar::activateAt(int index) const void TabBar::activateAt(int index) const
{ {
if (getCurrentTabIndex() != index) 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); ::SendMessage(_hSelf, TCM_SETCURSEL, index, 0);
}
TBHDR nmhdr; TBHDR nmhdr;
nmhdr._hdr.hwndFrom = _hSelf; nmhdr._hdr.hwndFrom = _hSelf;