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 » Prevent user from closing menubar Collapse All
Subject Author Date
Jonas Gauffin Dec 7, 2005 - 3:41 AM

I’m using the CExtMenuBar class. Is there a way to prevent the user of closing it, or make sure that it’s always loaded/visible at startup?

Technical Support Dec 7, 2005 - 6:47 AM

What you need to do is to remove the Close button. This is applicable for any toolbar including the menu bar. Just override the OnNcAreaButtonsReinitialize() method like as follows:

class CMyMenuControlBar : public CExtMenuControlBar
{
protected:    
 virtual void OnNcAreaButtonsReinitialize()
 {
  INT nCountOfNcButtons = NcButtons_GetCount();
  if( nCountOfNcButtons > 0 )
   return;
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
  NcButtons_Add( new CExtBarNcAreaButtonAutoHide(this) );
#endif
  NcButtons_Add( new CExtBarNcAreaButtonMenu(this) );
 }
};


Jonas Gauffin Dec 7, 2005 - 9:49 AM

thank you.