Print Page | Close Window

How do add other controls to tab bar?

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=2261
Printed Date: 09 November 2025 at 7:36am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How do add other controls to tab bar?
Posted By: jeffcmj
Subject: How do add other controls to tab bar?
Date Posted: 20 May 2005 at 8:45am

Hi, is there a way to add more custom buttons/control to a tab bar? My current project needs to do that but I have no idea on how to.

Thanks




Replies:
Posted By: jeffcmj
Date Posted: 01 June 2005 at 11:48am
Basically what I want is to add another button on the left of 3 navigation buttons.  At first, I looked for an function like "AddNavigationButton(...) ", but found nothing. So could oleg or other toolkit guru give some advices ?


Posted By: Oleg
Date Posted: 03 June 2005 at 1:31am

right, seems we forgot GetNavigateButtons method,

so you must

1. overrdie CXTPTasbControl,

2. in constructor call

m_arrNavigateButtons.Add(new CNavigateButtonOptions(this,

xtpTabNavigateButtonAlways));

3. create CNavigateButtonOptions and override

virtual void DrawEntry(CDC* pDC, CRect rc); // to draw



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jeffcmj
Date Posted: 03 June 2005 at 11:12pm

Thanks oleg. But it looks like the mdi tab is not done by CXTPTasbControl. It's CXTPTabClientWnd.Do you know where shall I override? If it's not possible, may I ask you to put this issue to v10.0?

Thanks



Posted By: Oleg
Date Posted: 08 June 2005 at 11:29pm

Yo can try override

CXTPTabClientWnd::CWorkspace*  AddWorksapce(int nIndex)

call base class and add new button for new workspace.

We added CXTPTabManager::GetNavigateButtons() member for next release.



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jeffcmj
Date Posted: 09 June 2005 at 2:28am

Thanks oleg. That's exactly what I tried to do. But it seems the derived class can not access the m_arrNavigateButtons.

CMaxTabManager::CWorkspace* CMaxTabManager::AddWorksapce(int nIndex)
{
 CWorkspace* pWorkspace = CXTPTabClientWnd::AddWorksapce(nIndex);
// pWorkspace->m_arrNavigateButtons.Add(new CNavigateButtonArrowLeft(this, xtpTabNavigateButtonAutomatic));
 return pWorkspace;
}

If I un-comments the above line, there will be a compiling error.



Posted By: Oleg
Date Posted: 09 June 2005 at 4:06am

I know :) Whats why we added CXTPTabManager::GetNavigateButtons, please patch your source to make it possible:

in XTPTabManagher.h: add

typedef CArray<CXTPTabManagerNavigateButton*, CXTPTabManagerNavigateButton*> CXTPTabManagerNavigateButtons;

CXTPTabManagerNavigateButtons* CXTPTabManager::GetNavigateButtons() {
 return &m_arrNavigateButtons;

}



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: jeffcmj
Date Posted: 14 June 2005 at 4:40am

Thanks. Now I am able to add more navigate buttons.

But may I have another little request. I would like my navigate button on the left side of the tab bar. I used the following code, in my derived CXTPTabManagerNavigateButton class:

virtual void Reposition(CRect& rcNavigateButtons)
 {
  if (m_dwFlags == xtpTabNavigateButtonAlways || m_dwFlags == xtpTabNavigateButtonAutomatic)
  {
   if (m_pManager->IsHorizontalPosition())
   {
    m_rcButton.SetRect(rcNavigateButtons .left, rcNavigateButtons.CenterPoint().y + m_szButton.cy / 2 - m_szButton.cy, rcNavigateButtons.left + m_szButton.cx, rcNavigateButtons.CenterPoint().y + m_szButton.cy / 2);
    rcNavigateButtons.left += m_szButton.cx;
   } else
   {
    m_rcButton.SetRect(rcNavigateButtons .CenterPoint().x - m_szButton.cx / 2, rcNavigateButtons.bottom - m_szButton.cy, rcNavigateButtons.CenterPoint().x - m_szButton.cx / 2 + m_szButton.cx, rcNavigateButtons.bottom);
    rcNavigateButtons.bottom -= m_szButton.cy;
   }
  }
  else
  m_rcButton.SetRectEmpty();
 }

It supposed to work, but actually not. With above code, the tab item will not be drawn. Will it work in 9.7 or 10.0 ?

Best

Jeff




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