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 Tech Support » Defualt Prof-UIS context menu Collapse All
Subject Author Date
Gevork Odabashyan Oct 19, 2006 - 7:39 AM

Hellow

I want dynamic control bar’s menu item not to appear in all context menus if this bar is in invisible state. In main menu this can be done by usage CExtDynamicControlBar::OnInsertDynamicBarCommandIntoPopupMenu method. But this doesn’t affects the default Prof-UIS context menu. Dynamic bar’s items are always visible in it. Is it real to you to apply CExtDynamicControlBar::OnInsertDynamicBarCommandIntoPopupMenu on this problem? Or what I’ve got to do?

Suhai Gyorgy Oct 19, 2006 - 8:53 AM

You can read more about the customization of built-in context menus here: How to modify or suppress entirely built-in pop-up menus available in Prof-UIS?

I can imagine your handler method like this:

LRESULT CMainFrame::OnConstructPopupMenuCB(WPARAM wParam, LPARAM lParam)
{
	ASSERT_VALID( this );
	CExtControlBar::POPUP_MENU_EVENT_DATA * p_pmed =
		CExtControlBar::POPUP_MENU_EVENT_DATA::FromWParam( wParam );
	ASSERT( p_pmed != NULL );
	ASSERT_VALID( p_pmed->m_pPopupMenuWnd );
	if( p_pmed->m_bPostNotification )
	{
		UINT uPos = p_pmed->m_pPopupMenuWnd->ItemFindPosForCmdID(ID_VIEW_YOUR_BAR);
		if ( uPos >= 0 && !(_is_visible(ID_VIEW_YOUR_BAR)) )
			VERIFY( p_pmed->m_pPopupMenuWnd->ItemRemove( uPos ));
		while (p_pmed->m_pPopupMenuWnd->ItemGetCount() > 0 && p_pmed->m_pPopupMenuWnd->ItemGetCmdID(0) == CExtPopupMenuWnd::TYPE_SEPARATOR)
			p_pmed->m_pPopupMenuWnd->ItemRemove(0);
	}
	return 0;
}

Gevork Odabashyan Oct 20, 2006 - 3:45 AM

Thank you, Gyorgy! It works :)

As for m_bAppearInDockSiteControlBarPopupMenu flag - I don’t know how to use it. I need to set or drop it when dynamic control bar change it’s visibility. But I don’t know any virtual function that is called when the bar change it’s state/visibility.

Technical Support Oct 19, 2006 - 8:48 AM

You can exclude any control bar (toolbar, menu bar, control bar, or panel bar) from the menu with the list of all control bars created in the frame window using this code:

m_wndBar.m_bAppearInDockSiteControlBarPopupMenu = false;

Suhai Gyorgy Oct 19, 2006 - 8:54 AM

Much easier one :)