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 » Some questions about the context menu in main frame Collapse All
Subject Author Date
mai mike Aug 14, 2008 - 6:36 AM

Dear Technical team,



The samples name TabPages.



There are  5 control bar, 2 toolbars and menu in



this application. Thay are "Menu bar", "Standard



Toolbar", "UI theme swithch toolbar",



"Resiable bar0", "Resiable bar1", "Resiable bar2",



"Resiable bar3", "Resiable bar4".



There is a context menu can be pop-up when I user



click Right button of the mouse on the main frame,



on the toolbar or on the  capture of each control



bar. The menu item includes "Menu bar", "Standard



Toolbar", "UI theme swithch toolbar",



"Resiable bar0", "Resiable bar1", "Resiable bar2",



"Resiable bar3", "Resiable bar4".



I can not show you the picture. Can you understand



what i said?



I have some question about this menu



1. Do any method can be use to disable or remove



any items of this context menu?



2. As you know. the method named



CFrameWnd::OnBarCheck( UINT nID ) will be invoked



when the user click any item in the contex menu.



If I want to take care this action in the control



bar. for example , the method name



CMyControlBar::Handle this action(..) will be



invoked when



the user click any item, not CFrameWnd::OnBarCheck(



UINT nID ).



How can I do it? How can I know which item is



clicked just now?



3. As you know, the method named



CExtContrlBar::DoFrameBarCheckCmd( CFrameWnd



*pFrame, UINT nBarID, bool bResizablecheckmarks)



can be use to show or hide the control bar when the



user click the context menu.



But if the control bar is auto-hide mode, the



method CExtContrlBar::DoFrameBarCheckCmd( CFrameWnd



*pFrame, UINT nBarID, bool bResizablecheckmarks) 



can’t hide the control bar, means the control bar



can’t be see in the screen.



Does any method can be use to hide the control bar,



means the control bar can’t be see in the screen?



Does any method can be use to let the control bar



in auto-hide mode when the application start?





Thank you in advance.



Best regards



Mike Mai

Technical Support Aug 16, 2008 - 1:20 PM

You can handle the CExtControlBar::g_nMsgConstructPopupMenu registered message in the main frame window for re-building, modifying or suppressing any of Prof-UIS build-in menus displayed over main frame areas. This message is available in any Prof-UIS version. The CMainFrame::OnConstructPopupMenuCB() method in the ProfStudio sample application handles this registered message and completely replaces all the default Prof-UIS menus with its own menus. Your main frame should simply construct popup menus which have no menu items at all. Such popup menus will not be displayed. The CExtControlBar::DoFrameBarCheckCmd() and CExtControlBar::DoFrameBarCheckUpdate() static methods are simply contain universal command handler/updating code for control bar show/hide commands. MFC provides two ready to use methods which can be inserted into your main frame’s message map for handling MFC control bar commands: CFrameWnd::OnBarCheck() and CFrameWnd::OnUpdateControlBarMenu(). But Prof-UIS control bars have more advanced features and these two MFC methods are not always well compatible with Prof-UIS control bars. That is why most of our sample applications re-define these methods using forwarded invocations of the CExtControlBar::DoFrameBarCheckCmd() and CExtControlBar::DoFrameBarCheckUpdate() static methods:

BOOL CMainFrame::OnBarCheck( UINT nID )
{
      return CExtControlBar::DoFrameBarCheckCmd( this, nID, false );
}

void CMainFrame::OnUpdateControlBarMenu( CCmdUI * pCmdUI )
{
      CExtControlBar::DoFrameBarCheckUpdate( this, pCmdUI, false );
}


To show/activate any resizable control bar in any state you should send the WM_COMMAND message to the main fame window and specify bar’s dialog control identifier as WPARAM parameter. This approach can be replaced with single invocation of the CExtControlBar::DoFrameBarCheckCmd() method.

You can hide any resizable control bar using the CFrameWnd::ShowControlBar() method. But you first check whether the resizable control bar is in the auto-hidden state using the CExtControlBar::AutoHideModeGet() method. The auto-hidden bars should be switched into simple hidden state using the CExtControlBar::AutoHideModeSet() method.