Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - A little problem with CXTFlatTabCtrl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

A little problem with CXTFlatTabCtrl

 Post Reply Post Reply
Author
Message
Karnize View Drop Down
Newbie
Newbie
Avatar

Joined: 20 October 2003
Location: Italy
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Karnize Quote  Post ReplyReply Direct Link To This Post Topic: A little problem with CXTFlatTabCtrl
    Posted: 05 November 2003 at 3:37am

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.

Back to Top
xtreme View Drop Down
Newbie
Newbie


Joined: 13 January 2004
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote xtreme Quote  Post ReplyReply Direct Link To This Post Posted: 13 January 2004 at 10:07am

Dear Sir,

I'm just a begineer of this tool kit & looking for some sample on How to use CXTFlatTabCtrl on MDI application in vc++ , Could you please suggest me some example on the above subject or send some source code sample.

Thanks & Regards

Xtreme

 

 

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.