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 » CExtControlBar question Collapse All
Subject Author Date
David Skok Apr 25, 2007 - 8:24 AM

How can I prevent the close box ’X’ from being displayed? I also want to disable tearing a controlbar from it’s dock site to float it. I still want the control bar to be retractable and keep the pin icon.

Technical Support Apr 26, 2007 - 4:03 AM

You can remove the close button by overriding OnNcAreaButtonsReinitialize() in this way

virtual void OnNcAreaButtonsReinitialize()
{
      ASSERT_VALID( this );
      INT nCountOfNcButtons = NcButtons_GetCount();
      if( nCountOfNcButtons > 0 )
            return;
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
      NcButtons_Add( new CExtBarNcAreaButtonAutoHide(this) );
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
      // NcButtons_Add( new CExtBarNcAreaButtonExpand(this) );
      NcButtons_Add( new CExtBarNcAreaButtonMenu(this) );
}
To prevent the control bar from being switched into the floating state, you should also override the CExtControlBar::FloatControlBar() and CExtControlBar::ToggleDocking() methods. Just leave their bodies empty. But this will work with Visual Studio 2003’s drag-and-drop docking algorithm is used, not with Visual Studio 2005’s one. However you can always use the 2003 algoritm regardless of the current paint manager if you override CExtControlBar::OnQueryDockingType() and return __RESIZABLE_DOCKING_TYPE_STUDIO_2003 in it.

Besides, you should do the same for tabbed control bar containers which are also control bars. This is described in How to remove the close button ("X") from the control bar?