Hello,
I have a little problem with CXTFlatTabCtrl. After I create a tab control and add some pages to it I need non zero page to be currently selected. But if I do so, this non zero page displayed as the first page (i.e. in the left corner of the control) and all pages before this one will be behind the left side. It not depends on the actual size of the tab control.
In my case I have wide enough tab control and only two pages in it, so I decide to hide scroll arrows. So if now I select as current the second page in tab control after it creating, I have not access to the first tab because it located behind the control border.
Also sometimes all tabs located behind the border.
I look to the code and found the place where the problem located. In SetCurSel function you have the next code:
if (rcItem.left <= 0) m_nOffset += rcItem.left; else { // test if the tab is off on the right rcItem.right -= iTotalArrowWidth; int iTabAreaWidth = GetTotalTabAreaWidth(); if (rcItem.right > iTabAreaWidth) m_nOffset += (rcItem.right - iTabAreaWidth); }
|
so if I select the second page the 'else' branch will be executed and GetTotalTabAreaWidth() returns the negative value, because the m_xGripperPos member is negative (because 'const int sbExtreme = (m_nClientWidth - 4 * m_cx - m_cy);' in SetGripperPosition function give the negative value while m_nClientWidth is zero). So m_nOffset became very big.
It is not so easy for me to understand how you draw tabs so I temporary solve the problem like here:
if (rcItem.left <= 0) m_nOffset += rcItem.left; else { // test if the tab is off on the right rcItem.right -= iTotalArrowWidth; int iTabAreaWidth = GetTotalTabAreaWidth(); if (rcItem.right > iTabAreaWidth && iTabAreaWidth >= 0) m_nOffset += (rcItem.right - iTabAreaWidth); }
|
but I didn`t sure what it is a correct solution.
|