Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Initially disable customizable toolbar button Collapse All
Subject Author Date
RICHARD ALTON Sep 27, 2010 - 9:08 AM

Please could you tell me how to initially hide a button on a customizable toolbar? I want to simulate in code what happen when the user clicks on the add/remove buttons drop-down menu on the toolbar, i.e. I want to populate the toolbar with lots of buttons but then by default hide some of these. All my attempts at this just result in the button not being added at all to the toolbar, i.e. they do not appear in the menu to be re-added if so desired.


Any help would be appreciated, thanks.

Technical Support Sep 27, 2010 - 12:11 PM

You should apply the __ECTN_TBB_HIDDEN style to the command tree node of the toolbar button both in the initial and current command trees of toolbar:

CExtCustomizeSite * pSite = . . .
CExtToolControlBar * pBar = . . .
UINT nButtonID = . . .
CExtCustomizeCmdTreeNode * pNodeC = NULL, * pNodeI = NULL;
            VERIFY( pSite->GetToolbarCustomizeInfo( pBar, &pNodeC, &pNodeI );
            ASSERT( pNodeI != NULL && pNodeC != NULL );
            pNodeI->GetNode( true )->SearchNodeElement( nButtonID, -1, false, true )->ModifyFlags( __ECTN_TBB_HIDDEN );
            pNodeC->GetNode( true )->SearchNodeElement( nButtonID, -1, false, true )->ModifyFlags( __ECTN_TBB_HIDDEN );