|
|
|
|
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 |
|
Dave Kymlicka
|
Apr 5, 2005 - 6:10 PM
|
Prior to ProfUIS 2.31, implementing CMainFrame::OnConstructPopupMenuCB() would override default r/click popup menu behvaiour. Now, with c2.31, popup menus are appearing again. I can trace to: CExtDynamicBarHookSink::OnHookWndMsg().
Can you please suggest a good technique to gain control of pop-up menus again?
I interested disabling all your r/click pop-ups, except the following scenarios: 1. R/click in NCarea (only!) of CExtDynamicControlBar, when in __EDBS_FLOATING, __EDBS_DOCKED, and __EDBS_AUTO_HIDDEN states 2. r/click in MDI tabs of CExtDynamicControlBar when they are in __EDBS_DOCUMENT state. 3. r/click in vacant toolbar area
I’m sure other readers would also be interested in the more general approach/technique of how r/click should now be handled.
|
|
Technical Support
|
Apr 7, 2005 - 11:36 AM
|
Dear Dave, The behavior of the build-in popup menu control was not changed. You should be able to do with it everything you need as it is done in ProfStudio sample. As you know the CExtControlBar::g_nMsgConstructPopupMenu registered windows message passes a pointer to the CExtControlBar::POPUP_MENU_EVENT_DATA object in the WPARAM parameter. This object allows you to cancel pop-up menu tracking. If you do not need to display the pop-up menu on the screen, just remove all the items in pop-up menu. Here is an approximate solution:LRESULT CMainFrame::OnConstructPopupMenuCB(
WPARAM wParam, LPARAM lParam )
{
ASSERT_VALID( this );
lParam; // unused parameter
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_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_DOCKBAR_CTX
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CONTROLBAR_NC_CTX
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_AUTOHIDESLIDER_CTX
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_MDITABS_CTX
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_DYNCBCTABS_CTX
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CONTROLBAR_NCBTNMENU_TOP
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CONTROLBAR_NCBTNMENU_BARS
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CTXEXPBTN_TOP
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CTXEXPBTN_APPEND
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CTXEXPBTN_BARS
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_CONTROLBAR_NCBTNMENU_DYNSTATE
|| p_pmed->m_nHelperNotificationType ==
CExtControlBar::POPUP_MENU_EVENT_DATA::
__PMED_TAB_PAGE_CONTAINER_TABS_CTX
)
return 0;
VERIFY( p_pmed->m_pPopupMenuWnd->ItemRemove() );
return (!0);
}
|
|
Dave Kymlicka
|
Apr 9, 2005 - 5:26 PM
|
Perfect, just what I needed - thanks!
I found this chunk of code in another posting, should I also use it in the code you’ve provided above? If so, where? Can you explain its purpose?
if( p_pmed->m_bPostNotification ) { return 0; }
Thanks!
|
|
Technical Support
|
Apr 10, 2005 - 10:54 AM
|
The lines of code above have nothing to do with your task and you should not use this code. Each build-in menu’s/submenu’s construction message is sent twice to the main frame window. At first, the menu is empty and the p_pmed->m_bPostNotification flag is set to false . Here you can construct appropriate menus from scratch and return a non-zero value to prevent the second message to be sent. Otherwise, return zero. The second time, the menu is constructed by default and p_pmed->m_bPostNotification is set to true . In this case you can modify the default built-in menu. In any case, if the final menu is empty, it is not displayed.
|
|
Dave Kymlicka
|
Apr 11, 2005 - 12:50 PM
|
Excellent, now I understand. Thank you!
|
|