The CXTPTabWorkspace control does not exclude the button region from the tab hit test. This makes a partial tab displayed under the button area show as Hovering over when the mouse is in the button area. Also allows you to Drag a tab when starting the drag in the button area.
Solution:
Add protected int m_nButtonWidth member to CXTPTabWorkspace. In paint manager DrawTabControlXXXXX functions at the top of each function clear this variable to 0 and after caclulating the nButtonWidth local variable assign the value to pCtrlTab->m_nButtonWidth. In every style of paint manager DrawTabControlXXXX.
Change HitTest to exclude that area from a valid tab button area.
int CXTPTabWorkspace::HitTest(CPoint point) { CRect rc;
GetClientRect(&rc); rc.right -= m_nButtonWidth;
if (rc.PtInRect(point)) { for (int i = 0; i < m_arrTab.GetSize(); i++) { if (m_arrTab.rcItem.PtInRect(point)) { return i; } } } return -1; }
|
Add the same wrapper in CXTPTabWorkspace::OnMouseMove
void CXTPTabWorkspace::OnMouseMove(UINT nFlags, CPoint point) { CRect rc;
GetClientRect(&rc); rc.right -= m_nButtonWidth;
if (rc.PtInRect(point)) { if (m_nItemTracking != -1) { . . .
} }
else
{
if (TRUE)//if (m_dwStyle & CBRS_ALIGN_TOP) { m_btnClose.CheckForMouseOver(this, point); m_btnLeft.CheckForMouseOver(this, point); m_btnRight.CheckForMouseOver(this, point); } }
HighlightFocused();
CWnd::OnMouseMove(nFlags, point); }
|
The tabs will stop seeing the mouse in the button area as over the tab. Someone who is more familiar with the toolkit should review this fix. I could have easily missed something critical.
|