|
|
|
|
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 |
|
Andrew Banks
|
Feb 3, 2007 - 8:33 AM
|
Have a RibbonBar button with the __ECTN_TBB_SEPARATED_DROPDOWN style.
I see how to fill its menu at design time.
Cant see how to catch the click on the button to runtime fill the popup menu.
For example, Ribbonbar combox have: OnPopupListBoxInitContent to fill at run time.
|
|
Technical Support
|
Feb 5, 2007 - 11:59 AM
|
|
|
Andrew Banks
|
Feb 5, 2007 - 12:46 PM
|
Yea, but this popup was created from a ribbon bar node. Like below pRibbonGroupEntry->ModifyFlags( __ECTN_TBB_SEPARATED_DROPDOWN );
So, I can’t do what you say.
As I said for example, Ribbon Bar combos are caught as follows: bool CMyRibbonBar::OnPopupListBoxInitContent( CExtBarButton * pTBB, CExtCustomizeCmdTreeNode * pNode, CListBox & wndListBox ) This is different from the normal way of catching combos.
I don’t see anything like this for RibbonBar menus So the problem is I dont know when the menu is about to popup.
|
|
Technical Support
|
Feb 6, 2007 - 3:42 AM
|
In your code you create some pRibbonGroupNode command button node which is configured as a drop-down button. Create only one child (CExtCustomizeCmdTreeNide ) in the pRibbonGroupNode node. The child node should have some known ID_MARKER command identifier. Add a CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel handler to your main frame class. The method will be invoked by any Prof-UIS popup menu immediately before it appears on the screen. In this method, make a search for the ID_MARKER command item. If the item is found, remove it and add a set of other menu items instead of removed item. Here is how the code may look: // Method declaration:
LRESULT OnExtMenuPrepareLevel( WPARAM wParam, LPARAM lParam );
// Message map entry:
ON_REGISTERED_MESSAGE( CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel, OnExtMenuPrepareLevel )
// Implementation template:
LRESULT CMainFrame::OnExtMenuPrepareLevel( WPARAM wParam, LPARAM lParam )
{
lParam;
CExtPopupMenuWnd::MsgPrepareMenuData_t * pData =
reinterpret_cast
< CExtPopupMenuWnd::MsgPrepareMenuData_t * >
( wParam );
ASSERT( pData != NULL );
CExtPopupMenuWnd * pPopup = pData->m_pPopup;
ASSERT( pPopup != NULL );
CExtPopupMenuWnd * pPopupParent = pPopup->GetParentMenuWnd();
INT nItemPos = pPopup->ItemFindPosForCmdID(ID_MARKER );
if( nItemPos >= 0 )
{
pPopup->ItemRemove( nItemPos );
// TO DO: insert other menu items into pPopup sub menu here
} // if( nItemPos > 0 )
return 1;
|
|