Print Page | Close Window

A little problem with CXTFlatTabCtrl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=214
Printed Date: 23 December 2024 at 7:40am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: A little problem with CXTFlatTabCtrl
Posted By: Karnize
Subject: A little problem with CXTFlatTabCtrl
Date 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.




Replies:
Posted By: xtreme
Date 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

 

 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net