Reset tooltip |
Post Reply |
Author | |
maxxan
Groupie Joined: 15 July 2009 Status: Offline Points: 49 |
Post Options
Thanks(0)
Posted: 30 April 2015 at 3:39am |
Is it possible to not load tooltip info when loading customized ribbons or to reset only tooltips?
The problem is that then creating the ribbons, the tooltip is different depending on which license you have for the application. But this is not reflected in the button tooltip, since it loads button customizations etc., so it's not visible until I reset the ribbons. How to solve this, to use different tooltip when creating the ribbon and it becomes visible for the buttons?
|
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
We do this for the same purpose - licensing. We show a different tip based on the license (as in - "This is a wonderful command, but you don't have a license to use it." sort of string).
After we load the ribbon, we get the controls collection and spin through all the controls, get each ID and do a license check and modify the tooltip text, description etc. based on the license. We also have to get the QuickAccess control and run through its controls and change the tip data there too. We do that because we use CJ to save the QAT out for customization purposes and the tooltip is saved too. Here is some code. Note we have our own tooltip system and we use the Description for the actual tip and the tooltip text as a title. So this code only changes the description. void JCXTPRibbonBar::SetToolTipForUnlicensedCommands() { CXTPControls* pControls = GetControls(); CString strUnLicensed = GetLicenseNotAvailableTooltipString(); GUserText gutEnv = m_strEnvironment; if( pControls ) { int nNumControls = pControls->GetCount(); for( int Index = 0; Index < nNumControls; ++Index ) { CXTPControl* pControl = pControls->GetAt( Index ); if( pControl ) { if( !JIsCommandLicensed((LPCSTR)gutEnv,pControl->GetID() ) ) { // Yes I know the function is SetToolTipForUnlicensedCommands and that I am not calling SetToolTip on the // control but rather am setting the Description. But that's because we use the description as the tip and // the tip as the title. pControl->SetDescription( strUnLicensed ); } } } // for customization and any tip that is present is saved out and read back in. if (CXTPRibbonQuickAccessControls* pQAControls = GetQuickAccessControls()) { JFrameWnd* pFrame = (JFrameWnd*)JGetMainCFrameWnd30(); if( pFrame ) { int nControls = pQAControls->GetCount(); for (int nControl = 0; nControl < nControls; ++nControl) { if (CXTPControl* pControl = pQAControls->GetAt(nControl)) { if( JIsCommandLicensed((LPCSTR)gutEnv,pControl->GetID() ) ) { CString strMessage; pFrame->GetMessageString(pControl->GetID(), strMessage ); if( !strMessage.IsEmpty() ) { pControl->SetDescription( strMessage ); } } } } } } } } |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |