|
|
|
|
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.
Subject |
Author |
Date |
|
Ionut Ceausu
|
Feb 16, 2005 - 10:55 AM
|
Hello. How can I disable the menu that appear on mouse right click when I’m in CExtControlBar. I don’t need this menu and I want him do disapear. Thank
|
|
Technical Support
|
Feb 16, 2005 - 11:22 AM
|
We guess you have nothing against the context menu with a list of all toolbars and resizable control bars but you don’t want this menu to appear over the window inserted into the resizable control bar. In this case, just add a message handler for the WM_CONTEXTMENU Windows message to the window inside the resizable control bar. This message handler should do nothing or show your own context menu
|
|
Ionut Ceausu
|
Feb 17, 2005 - 8:50 AM
|
That’s works fine if the control bar is docked. But if the control bar is floating and I right click on the title of the control bar, the menu still appear although I have a handler for WM_CONTEXTMENU (which works fine in the rest of the cases). Could you tell me how I get rid of this menu (is good but I do not need it).
|
|
Technical Support
|
Feb 17, 2005 - 11:08 AM
|
Of course you can avoid displaying of built-in Prof-UIS menus. Your frame window receives the CExtControlBar::g_nMsgConstructPopupMenu registered windows message which allows you to construct, modify or cancel any built-in menu. Add the following code to your main frame class and its message map:afx_msg LRESULT OnConstructPopupMenuCB(
WPARAM wParam, LPARAM lParam );
ON_REGISTERED_MESSAGE(
CExtControlBar::g_nMsgConstructPopupMenu,
OnConstructPopupMenuCB
)
LRESULT CMainFrame::OnConstructPopupMenuCB(
WPARAM wParam, LPARAM lParam )
{
wParam;
lParam;
return (!0);
}
This implementation of the CExtControlBar::g_nMsgConstructPopupMenu message handler cancels any built-in menu. For instance, the following implementation cancels context menus over any dockable control bars (menu bar, toolbar, or resizable control bar) and status bar:LRESULT CMainFrame::OnConstructPopupMenuCB(
WPARAM wParam, LPARAM lParam )
{
ASSERT_VALID( this );
lParam;
CExtControlBar::POPUP_MENU_EVENT_DATA * p_pmed =
CExtControlBar::POPUP_MENU_EVENT_DATA::
FromWParam( wParam );
ASSERT( p_pmed != NULL );
ASSERT_VALID( p_pmed->m_pPopupMenuWnd );
ASSERT_VALID( p_pmed->m_pWndEventSrc );
ASSERT(
p_pmed->m_pWndEventSrc->
GetSafeHwnd() != NULL
);
ASSERT(
::IsWindow(
p_pmed->m_pWndEventSrc->
GetSafeHwnd())
);
if( p_pmed->m_bPostNotification )
return 0;
if( p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CONTROLBAR_CTX
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CONTROLBAR_NC_CTX
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_STATUSBAR_CTX
)
return (!0);
return 0;
}
By playing with __PMED_... constants, you can cancel any context menu. The declarations and descriptions of all these constants you can find in the ExtControlBar.cpp file
|
|
Ionut Ceausu
|
Mar 11, 2005 - 9:56 AM
|
Let’s suppose that from CMainFrame we construct more CExtControlBar derived class, each of them displaying individual data. Each of this CExtControlBar derived should have an individual context menu that is build at run time. But I have one problem: I am not able to intercept the message g_nMsgConstructPopupMenu in CExtControlBar derived class. I could use OnContextMenu, but this method is not called when the user right click on the title bar of the CExtControlBar. How can I intercept g_nMsgConstructPopupMenu in the CExtControlBar derived class?
|
|
Technical Support
|
Mar 11, 2005 - 12:55 PM
|
If you want to customize any context menu over control bar areas displayed by Prof-UIS framework, then you should handle the CExtControlBar::g_nMsgConstructPopupMenu registered windows message as it is done in the ProfStudio application (CMainFrame::OnConstructPopupMenuCB() method):LRESULT CMainFrame::OnConstructPopupMenuCB(
WPARAM wParam, LPARAM lParam
)
{
ASSERT_VALID( this );
lParam;
CExtControlBar::POPUP_MENU_EVENT_DATA * p_pmed =
CExtControlBar::
POPUP_MENU_EVENT_DATA::
FromWParam( wParam );
ASSERT( p_pmed != NULL );
ASSERT_VALID( p_pmed->m_pPopupMenuWnd );
ASSERT_VALID( p_pmed->m_pWndEventSrc );
ASSERT( p_pmed->m_pWndEventSrc->GetSafeHwnd() != NULL );
ASSERT( ::IsWindow(p_pmed->m_pWndEventSrc->GetSafeHwnd()) );
if( p_pmed->m_bPostNotification )
{
// if you want to construct popup menu completely,
// then do it and return 0 here
}
else
{
// modify default menu
return 0;
}
}
This message handler allows you to modify or completely reconstruct any built-in Prof-UIS menu. The p_pmed->m_nHelperNotificationType value can be one of the following list: __PMED_DOCKBAR_CTX - dockbar context menu __PMED_CONTROLBAR_CTX - any control bar context menu (client area) __PMED_CONTROLBAR_NC_CTX - any control bar context menu (non-client area) __PMED_STATUSBAR_CTX - status bar context menu __PMED_AUTOHIDESLIDER_CTX - autohide slider window context menu __PMED_MINIFRAME_NC_CTX - miniframe context menu (non-client area) __PMED_MDICLIAREA_CTX - MDI client area context menu __PMED_MDITABS_CTX - MDI-tabs window __PMED_AUTOHIDETABS_CTX - autohide-tabs window __PMED_DYNCBCTABS_CTX - dynamic control bar container tabs window __PMED_CONTROLBAR_NCBTNMENU_TOP - control bar nc-area-menu-button - top level __PMED_CONTROLBAR_NCBTNMENU_BARS - control bar nc-area-menu-button - control bars list __PMED_CTXEXPBTN_TOP - content expand button - top level __PMED_CTXEXPBTN_APPEND - content expand button - append to buttons list __PMED_CTXEXPBTN_BARS - content expand button - control bars list
If you need to add support for context menus over a window inside a resizable control bar, then you should handle the WM_CONTEXTMENU windows message in the window inserted into resizable bar and this will work. The g_nMsgConstructPopupMenu message is sent to window which handle is specified when invoking CExtPopupMenuWnd::CreatePopupMenu() or CExtPopupMenuWnd::LoadMenu() methods
|
|