Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How do add other controls to tab bar?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How do add other controls to tab bar?

 Post Reply Post Reply
Author
Message
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post Topic: How do add other controls to tab bar?
    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

Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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 ?
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jeffcmj View Drop Down
Groupie
Groupie


Joined: 28 October 2004
Status: Offline
Points: 92
Post Options Post Options   Thanks (0) Thanks(0)   Quote jeffcmj Quote  Post ReplyReply Direct Link To This Post 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

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.078 seconds.