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 General Discussion » Turn off toolbar button text Collapse All
Subject Author Date
Ganesan Umanesan Mar 30, 2005 - 7:54 PM

How can I turn off the toolbar button text for all toolbar buttons? (I just want to show the icon without the text -- Im using site customization)

Technical Support Mar 31, 2005 - 9:06 AM

If you want your toolbar buttons to display only icons, just set the Default display style for each of them. Here is how it can be done. You can get all toolbars with the CExtCustomizeSite::BuildToolbarLists() method which returns the two lists with pointers to basic and user-defined toolbars. You can get the root command node of each toolbar by invoking CExtCustomizeSite::GetToolbarCmdNode( pToolBar, false ). Its child nodes correspond to toolbar buttons. Then call pNode->ModifyFlags( 0, __ECTN_DISPLAY_MASK ) for each tool button node. Finally, recalculate layout of the parent window of each toolbar which you can get by calling pToolBar->GetParentFrame(). Here is a sample code snippet:

CExtToolControlBar * pBar = ....
UINT nCmdID = .....
 
      // get the root command tree nodes for toolbar 
      // (children nodes of these roots are representing 
      // command buttons in toolbar) 
      CExtCustomizeCmdTreeNode * pNodeRootInitial = 
            CExtCustomizeSite::GetToolbarCmdNode( 
                  pBar, 
                  true 
                  ); 
      ASSERT_VALID( pNodeRootInitial ); 
      CExtCustomizeCmdTreeNode * pNodeRootCurrent = 
            CExtCustomizeSite::GetToolbarCmdNode( 
                  pBar, 
                  false            
                  ); 
      ASSERT_VALID( pNodeRootCurrent ); 
 
      // get the command tree nodes for the 
      // toolbar button with command nCmdID 
      CExtCustomizeCmdTreeNode * pNodeButtonInitial = 
            pNodeRootInitial->ElementAt(
                  pNodeRootInitial->SearchNode( nCmdID )
                  );
      ASSERT_VALID( pNodeButtonInitial ); 
 
      CExtCustomizeCmdTreeNode * pNodeButtonCurrent = 
            pNodeRootCurrent->ElementAt( 
                  pNodeRootCurrent->SearchNode( nCmdID )
                  ); 
      ASSERT_VALID( pNodeButtonCurrent ); 
 
      // change display style of button’s nodes 
      // (remove display style flags and then assign new) 
      pNodeButtonInitial->ModifyFlags( 0, __ECTN_DISPLAY_MASK ); 
      pNodeButtonCurrent->ModifyFlags( 0, __ECTN_DISPLAY_MASK ); 
      pNodeButtonInitial->ModifyFlags( 
        __ECTN_DISPLAY_DEFAULT_STYLE 
     ); 
      pNodeButtonCurrent->ModifyFlags( 
        __ECTN_DISPLAY_DEFAULT_STYLE 
     );

Chris Johnson Apr 13, 2005 - 4:36 PM

Is this really the simplest way to do this?

These should be standard library functions:

CExtControlBar::EnableCommandImages(bool bEnable)
CExtControlBar::EnableCommandText(bool bEnable)

or something similar.

Technical Support Apr 14, 2005 - 8:48 AM

It seems the real easiest solution is to reset all the toolbars because they have no text on buttons initially. We could add some global flag to disable text/images on any toolbar button. Please let us know whether you are interested in this.