Professional UI Solutions
Site Map   /  Register


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 » reacting on such main group command in File Ribbon Galery as SaveAs or Print Collapse All
Subject Author Date
Vlad K Jan 10, 2008 - 3:57 PM

if to drop down File menu on the RibbonBar, there some commands groups such as
Save As
which are expanded to another options if you place your mouse on the TriangleArrow at the right side of the menu.
These options works file...

But there is also a possibility for a user to click not on these [final] items but on their parent - so on "save as ..." or "print..." menu items which are directly placed on file menu.

In the Examples it is not possible to put a handles on these main items.

The code does never goes here (..\Samples\RibbonBar:)
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
if( nID == ID_FB_PRINT && nCode == CN_COMMAND && pExtra == NULL )
// never goes here

Howeverm, the code does enter here if i click on the main menu:
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
if( nID == 0xFFFFu && nCode == CN_COMMAND && pExtra == NULL )

It looks like some initialization is missing?
How to solve it?



Vlad K Jan 11, 2008 - 11:23 AM



the call to g_CmdManager->CmdAllocPtr() did the trick!

it did work!


Technical Support Jan 11, 2008 - 11:10 AM

The MFC’s command updating/handing mechanism is invoked for command items only. Popup sub menu items are not command items and clicking them simply open the next menu level. The split-like popup sub menu items are both command and popup sub menu items at the same time. The arrow button on the right part of such menu item works like a popup sub menu item. The main part of split menu item works like a command item. Split menu items and split toolbar buttons in Prof-UIS are based on two command identifiers: the basic command identifier is used as a unique command identifier of menu item or toolbar button and the effective command identifier is used in MFC’s command updating/handling mechanism when the command part of the split toolbar button/menu item is clicked.

We have carefully checked the issue you have reported and found that somehow the ID_FB_PRINT command is not described in the command manager. Putting the following code into the CMainFrame::OnCreate() method before ribbon bar creation makes the command handing code invoked:

Please give us several days more for finding what’s really wrong. At this moment we found only a small Prof-UIS improvement which kills this issue. It requires an updated version of the CExtPopupMenuWnd::MENUITEMDATA::GetCmdID() method:
UINT CExtPopupMenuWnd::MENUITEMDATA::GetCmdID() const
      if( IsPopup() )
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
            CExtCustomizeCmdTreeNode * pNode =
                  ( const_cast < MENUITEMDATA * > ( this ) )
                        -> GetCmdNode();
            if( pNode == NULL )
                  return 0;
            ASSERT_VALID( pNode );
            if( ( pNode->GetFlags() & __ECTN_TBB_COLOR ) != 0 )
                  return 0;
            if( ( pNode->GetFlags() & (__ECTN_TBB_UNDO_REDO|__ECTN_TBB_SEPARATED_DROPDOWN) ) != 0 )
                  return pNode->GetCmdID();
#endif            return ( (UINT) (IDC_STATIC) );
      return m_nCmdID;