Print Page | Close Window

CXTPRibbonBar tab

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=3958
Printed Date: 10 February 2025 at 10:35pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPRibbonBar tab
Posted By: Italo
Subject: CXTPRibbonBar tab
Date Posted: 07 April 2006 at 1:31pm

How do I determine when a CXTPRibbonBar tab is changed?

 

Thanks,

Italo




Replies:
Posted By: Italo
Date Posted: 09 April 2006 at 8:05pm

I wasn’t able to find a wait to receive a tab change notification from the ribbon bar. So, I modified the XTP library as following. Please make these changes or implement a way to determine when a tab is changing and changed.

 

Add the following to XTPRibbonBar.h

 

protected:

 

      virtual BOOL OnBeforeTabChange(CXTPRibbonTab*) { return TRUE; }

      virtual void OnTabChanged(CXTPRibbonTab*) {}

 

 

 

Change SetCurSel in XTPRibbonBar.cpp

 

void CXTPRibbonBar::SetCurSel(int nIndex)

{

      CXTPTabManagerItem* pItem = m_pControlTab->GetItem(nIndex);

      if( pItem != NULL )

      {

             if( !OnBeforeTabChange( (CXTPRibbonTab*)pItem ) ) return;

             m_pControlTab->SetCurSel(nIndex);

             OnTabChanged( (CXTPRibbonTab*)pItem );

      }

}

 

 

 

Add the following to XTPRibbonControlTab.h

 

protected:

 

      BOOL OnBeforeItemClick(CXTPTabManagerItem* pItem);

      void OnItemClick(CXTPTabManagerItem* pItem);

 

 

 

Add the following to XTPRibbonControlTab.cpp

 

BOOL CXTPRibbonControlTab::OnBeforeItemClick(CXTPTabManagerItem* pItem)

{

      if( !GetRibbonBar()->OnBeforeTabChange( (CXTPRibbonTab*)pItem ) )

             return FALSE;

 

      return CXTPTabManager::OnBeforeItemClick(pItem);

}

 

void CXTPRibbonControlTab::OnItemClick(CXTPTabManagerItem* pItem)

{

      CXTPTabManager::OnItemClick(pItem);

 

      GetRibbonBar()->OnTabChanged( (CXTPRibbonTab*)pItem );

}



Posted By: ABuenger
Date Posted: 11 April 2006 at 4:27am

Instead of calling virtual methods you should send TCN_SELCHANGE and TCN_SELCHANGING notify messages to the owner.



Posted By: Italo
Date Posted: 11 April 2006 at 7:07am

What would be nice is to implement both methods, that way inheritors and owners can handle the notification. But, I was in a hurry and didn’t have the time to do it. Hopefully the XTP team will implement this.



Posted By: Italo
Date Posted: 24 April 2006 at 8:54am

Can someone from CodeJock please let me know if you're going to add something like this to the Ribbon bar?

Thanks,

Italo



Posted By: Oleg
Date Posted: 24 April 2006 at 10:42am
Yes, we will add your code and we will add notifications to owner window.

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



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