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 » Newbie: How to replace the default menu by CExtMenuControlBar? Collapse All
Subject Author Date
Martin Feb 2, 2004 - 3:22 AM

I downloaded the trial version. I created a new dialog based project using the ProfUI Wizard. I get a dialog in the Office 2003 Style. Now I want to use the menubar instead of the default menu.
Using other controls like combobox, button etc is no problem.
Could somebody tell me how to do this?
Thanks

Sergiy Lavrynenko Feb 3, 2004 - 1:51 AM

Dear Martin,


The Prof-UIS Controls sample, which is also available in Prof-UIS Freeware, demonstrates how to use the menu bar as a dialog control. Please add a custom control to your dialog and specify the string "ProfUIS-ControlBar" as its window class, IDC_MY_MENUBAR as its control identifier, the value 0x50402034 as its window style and the zero value as its extended style. Then add the CExtMenuControlBar m_wndMenuBar member variable to your dialog and the DDX_Control(pDX, IDC_MY_MENUBAR, m_wndMenuBar) line to the DoDataExchange() method’s body. To assign the menu resource you need to your menu bar, you should put the following lines into OnInitDialog():


 ASSERT( m_wndMenuBar.GetSafeHwnd() != NULL );
 if( !m_wndMenuBar.LoadMenuBar( IDR_MY_MENU_FOR_MENUBAR ) )
 {
  ASSERT( FALSE );
  return FALSE;
 }

To align your menu bar near the dialog border, you should put the following line at the end of the OnInitDialog() method:


 CWnd::RepositionBars(0,0xFFFF,0);

If you use the Prof-UIS resizable dialog as a base class for your dialog, then implement the WM_SIZE message handler in the following way:

 void CYourDlg::OnSize(UINT nType, int cx, int cy) 
 {
  CExtResizableDialog::OnSize(nType, cx, cy);
  if( nType != SIZE_MINIMIZED )
   CWnd::RepositionBars(0,0xFFFF,0);
 }

Best regards, Sergiy.