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 » RibbonMenu Bug Collapse All
Subject Author Date
tera tera Sep 7, 2009 - 4:05 AM

Hello.


At the time of the following menus.


A command message is not notified even if I click a menu.




 




CExtRibbonNode * _MuMakeRibbnoNodeDropDownAutoChgList(     CString csStr1, CString csStr2, CString csStr3,  UINT uiMeID, UINT uiID,     UINT uiIDLargeBmp, UINT uiIDSmallBmp,  CExtRibbonNodeGroup * pRibbonGroup,     BOOL bImage,     bool bSmall, bool bNormal, bool bLarge     ) {     //-------------------     // 端部種類     //CExtRibbonNode * pNode = new CExtRibbonNode( uiID );     CExtRibbonNode * pNode = new CExtRibbonNode( uiMeID , 0, NULL, 0, csStr1 );

    // デフォルトメニューID     pNode->SetCmdID ( uiID , true );  pNode->RibbonILE_RuleRemoveLargeILV();

 if ( uiIDLargeBmp != 0 ){ VERIFY( pNode->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(uiIDLargeBmp ) ) ); pNode->m_iconBig.m_bmpNormal.Make32(); pNode->m_iconBig.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );  }

 if ( uiIDSmallBmp != 0 ){ VERIFY( pNode->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(uiIDSmallBmp) ) ); pNode->m_iconSmall.m_bmpNormal.Make32(); pNode->m_iconSmall.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );  }

    // キャプションコメント     {     CExtCustomizeCmdScreenTip *pCmdScreenTip;     pCmdScreenTip = new CExtCustomizeCmdScreenTip;     pCmdScreenTip->CaptionMainSet ( csStr2 );     pCmdScreenTip->TextMainSet     ( csStr3 );     pNode->CmdScreenTipAttach( pCmdScreenTip );     pNode->CmdScreenTipSet   ( pCmdScreenTip, true, false );     }

    if( !bImage ){     pNode->ModifyFlags(      //__ECTN_DISPLAY_TEXTONLY_IN_MENU|     //__ECTN_TBB_AUTOCHANGE_ID  |  // イメージを自動的に変更する。     __ECTN_DISPLAY_TEXT_AND_IMAGE|  // テキストとイメージを表示     __ECTN_TBB_SEPARATED_DROPDOWN  // セパレーター付ドロップダウンメニュー     );     }     else{     pNode->ModifyFlags(     __ECTN_DISPLAY_TEXT_AND_IMAGE|  // テキストとイメージを表示     __ECTN_TBB_AUTOCHANGE_ID  |  // イメージを自動的に変更する。     __ECTN_TBB_SEPARATED_DROPDOWN  // セパレーター付ドロップダウンメニュー     );     }

    // アイコンの表示制御を決める     pNode->RibbonILE_RuleRemoveEntriesByILV( bSmall, bNormal, bLarge );

    if( pRibbonGroup != NULL ){     pRibbonGroup->InsertNode( NULL, pNode );     }     return pNode; }

------------------------------------------------------------------------------------

CExtCustomizeCmdTreeNode * _MuMakeRibbnoNodeDropDownList(     CString csStr1, CString csStr2, CString csStr3,  UINT uiID ,     UINT uiIDBmp,  CExtCustomizeCmdTreeNode * pNode ) {     CExtCustomizeCmdTreeNode * pTempNode = NULL;     CExtCmdIcon cIconTmp;

 if ( uiIDBmp != 0 ){ VERIFY( cIconTmp.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( uiIDBmp ) ) );     cIconTmp.m_bmpNormal.Make32();     cIconTmp.m_bmpNormal.AlphaColor( RGB(255,0,255), RGB(0,0,0), 0 );  }

    pTempNode = new CExtCustomizeCmdTreeNode(     uiID,     uiID,     NULL, 0,     csStr1,     csStr1,     csStr1, 0L, &cIconTmp );

    // キャプションコメント     {     CExtCustomizeCmdScreenTip *pCmdScreenTip;     pCmdScreenTip = new CExtCustomizeCmdScreenTip;     pCmdScreenTip->CaptionMainSet ( csStr2 );     pCmdScreenTip->TextMainSet     ( csStr3 );     pTempNode->CmdScreenTipAttach( pCmdScreenTip );     pTempNode->CmdScreenTipSet   ( pCmdScreenTip, true, false );     }     pNode->InsertNode( NULL, pTempNode );

    return pTempNode; }


Technical Support Sep 11, 2009 - 7:21 AM

Could you please insert your ribbon group initialization code into the RibbonBar sample application and try to reproduce this issue, then send it to us?


tera tera Sep 13, 2009 - 5:56 PM
Technical Support Sep 14, 2009 - 6:25 AM

Thank you for the test project. To fix the un-delivered command issue please update the source code for the following method:

UINT CExtBarButton::OnTrackPopup(
      CPoint point,
      bool bSelectAny,
      bool bForceNoAnimation
      )
{
      ASSERT_VALID( this );
CExtToolControlBar * pBar = GetBar();
      ASSERT_VALID( pBar );
bool bDockSiteCustomizeMode = pBar->_IsDockSiteCustomizeMode();
      if( bDockSiteCustomizeMode )
            return UINT(-1L);
      if( IsDisabled() && (! CanBePressedInDisabledState() ) )
            return UINT(-1L);
CWnd * pWnd = CtrlGet();
      if( pWnd != NULL )
      {
            LRESULT lResult = pWnd->SendMessage( CExtToolControlBar::g_nMsgContinueTrackMenu, WPARAM( this ), bSelectAny ? 1L : 0L );
            lResult;
            return UINT(-1L);
      }
      if( ! IsAbleToTrackMenu() )
            return UINT(-1L);
bool bPrevTBMT = CExtToolControlBar::g_bMenuTracking;
      if( CExtToolControlBar::g_bMenuTracking && pBar->_GetIndexOf(this) == pBar->m_nBtnIdxMenuTracking )
            return UINT(-1L);
      if( GetSeparatedDropDown() )
            m_bDropDownHT = true;
      CExtToolControlBar::_CloseTrackingMenus();
      if( pBar->IsFloating() )
      {
            pBar->ActivateTopParent();
            CFrameWnd * pFrame = pBar->GetDockingFrame();
            ASSERT_VALID( pFrame );
            pFrame->BringWindowToTop();
      }
CWnd * pWndCmdTarget = GetCmdTargetWnd();
      ASSERT_VALID( pWndCmdTarget );
CExtPopupMenuWnd * pPopup = OnCreatePopupMenuWnd();
      ASSERT_VALID( pPopup );
DWORD dwTrackFlags = OnGetTrackPopupFlags() | TPMX_OWNERDRAW_FIXED;
#if (!defined __EXT_MFC_NO_RIBBON_BAR)
      if( pBar->IsKindOf( RUNTIME_CLASS( CExtRibbonPage ) ) )
            dwTrackFlags |= TPMX_COMBINE_NONE|TPMX_RIBBON_MODE|TPMX_NO_HIDE_RARELY;
      else
            dwTrackFlags |= TPMX_COMBINE_DEFAULT;
#else
            dwTrackFlags |= TPMX_COMBINE_DEFAULT;
#endif
      if( bForceNoAnimation )
            dwTrackFlags |= TPMX_FORCE_NO_ANIMATION;
      if( bSelectAny )
            dwTrackFlags |= TPMX_SELECT_ANY;
      pPopup->TrackFlagsSet( dwTrackFlags );
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
CExtCustomizeCmdTreeNode * pNode = GetCmdNode();
      if( pNode != NULL )
      {
            ASSERT_VALID( pNode );
            VERIFY( pPopup->UpdateFromCmdTree( pWndCmdTarget->GetSafeHwnd(), pNode ) );
      }
      else
#endif
      {
            HMENU hMenu = GetMenu();
            ASSERT( hMenu != NULL );
            ASSERT( ::IsMenu(hMenu) );
            CMenu _menu;
            _menu.Attach( hMenu );
            VERIFY( pPopup->UpdateFromMenu( pWndCmdTarget->GetSafeHwnd(), &_menu, IsContainerOfPopupLikeMenu() ) );
            _menu.Detach();
      }
      if( IsAppendMdiWindowsMenu() && (! pBar->_IsDockSiteCustomizeMode() ) )
            pPopup->UpdateMdiWindowsMenu( pWndCmdTarget );
      CExtToolControlBar::g_bMenuTracking = bPrevTBMT;
CRect rcBtn = Rect();
      pBar->ClientToScreen( &rcBtn );
      pBar->ClientToScreen( &point );
      if( CExtToolControlBar::g_bMenuTrackingExpanded )
            dwTrackFlags |= TPMX_NO_HIDE_RARELY;
      pBar->_SwitchMenuTrackingIndex( pBar->_GetIndexOf( this ) );
      if(         GetAutoChangeID()
            &&    (! CExtControlBar::FindHelpMode(GetBar()) )
            &&    (! pBar->GetParent()->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) ) )
            )
      {
            HWND hWndBar = pBar->GetSafeHwnd();
            CExtToolControlBar::g_bMenuTracking = true;
            UINT nResultCmdID = 0;
            pPopup->m_hWndNotifyMenuClosed = pBar->GetSafeHwnd();
            if( GetSeparatedDropDown() )
                  m_bDropDownHT = true;
            g_pTrackingMenuTBB = this;
            if( ! pPopup->TrackPopupMenu(
                        dwTrackFlags|TPMX_NO_WM_COMMAND|TPMX_DO_MESSAGE_LOOP, point.x, point.y, &rcBtn, GetBar(),
                        CExtToolControlBar::_CbPaintCombinedContent, &nResultCmdID, true
                        )
                  )
            {
                  g_pTrackingMenuTBB = NULL;
                  if( ! ::IsWindow( hWndBar ) )
                        return UINT(-1L);
                  CExtToolControlBar::_CloseTrackingMenus();
                  return UINT(-1L);
            }
            g_pTrackingMenuTBB = NULL;
            if( ! ::IsWindow( hWndBar ) )
                  return UINT(-1L);
            if( pBar->_GetIndexOf( this ) < 0 )
                  return UINT(-1L);
            ModifyStyle( 0, TBBS_PRESSED );
            pBar->Invalidate();
            if( nResultCmdID == 0 )
                  return UINT(-1L);
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
            SetCmdID( nResultCmdID, true, false );
            CExtCustomizeCmdTreeNode * pNodeC = GetCmdNode( false );
            if( pNodeC != NULL )
            {
                  ASSERT_VALID( pNodeC );
                  CExtCmdItem * pCmdItem = g_CmdManager->CmdGetPtr( g_CmdManager->ProfileNameFromWnd( hWndBar ), nResultCmdID );
                  LPCTSTR strText =
                        ( pCmdItem != NULL )
                              ? ( pCmdItem->m_sToolbarText.IsEmpty()
                                          ? ( pCmdItem->m_sMenuText.IsEmpty() ? _T("") : pCmdItem->m_sMenuText )
                                          : pCmdItem->m_sToolbarText
                                    )
                              : _T("")
                              ;
                  pNodeC->SetTextInToolbar( strText );
                  pNodeC->SetTextInMenu( strText );
            }
            CFrameWnd * pFrame = pBar->GetParentFrame();
            if( pFrame != NULL )
                  pFrame->RecalcLayout();
            else
                  pBar->_RecalcLayoutImpl();
#else
            SetCmdID( nResultCmdID, true, true );
#endif
            OnDeliverCmd();
            if( ::IsWindow(hWndBar) )
                  pBar->_UpdateButton( pBar->_GetIndexOf(this) );
      }
      else
      {
            pPopup->m_hWndNotifyMenuClosed = pBar->GetSafeHwnd();
            if( GetSeparatedDropDown() )
                  m_bDropDownHT = true;
            g_pTrackingMenuTBB = this;
            if( ! pPopup->TrackPopupMenu(
                        dwTrackFlags, point.x, point.y, &rcBtn, GetBar(),
                        CExtToolControlBar::_CbPaintCombinedContent, NULL, true
                        )
                  )
            {
                  g_pTrackingMenuTBB = NULL;
                  CExtToolControlBar::_CloseTrackingMenus();
                  return UINT(-1L);
            }
            CExtToolControlBar::g_bMenuTracking = true;
            pBar->_SwitchMenuTrackingIndex( pBar->_GetIndexOf( this ) );
      }
      return UINT(-1L);
}



tera tera Sep 14, 2009 - 6:27 PM

Hello.


Please update the source code of prof-uis-com.


 

Technical Support Sep 16, 2009 - 3:46 AM

Uploaded.

Technical Support Sep 8, 2009 - 1:55 AM

We added the following code into the beginning of the <code>CMainFrame::OnCmdMsg()</span> method in the RibbonBar sample application:

 if( nID == ID_EDIT_PASTE )
      {
            if( nCode == CN_COMMAND && pExtra == NULL )
                  ::AfxMessageBox( _T("ID_EDIT_PASTE") );
            else if( nCode == CN_UPDATE_COMMAND_UI )
                  ((CCmdUI*)pExtra)->Enable();
            return TRUE;
      }

The Paste button inside the Home ribbon tab is exactly the same drop-down button. We tested its menu in any ribbon bar state including the most compressed and auto hidden layouts. It works OK. We saw the message box.
We guess the problem is really hidden somewhere in the message routing of your application.

tera tera Sep 11, 2009 - 1:52 AM

Hello.


I made a reproduction program.

Please test it.

Command does not respond it.



\


http://ifreeta.dee.cc/20090907/RibbonBar.lzh


 

tera tera Sep 11, 2009 - 1:54 AM

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) {

 if( nCode == CN_COMMAND && pExtra == NULL )  {   TRACE(" command --> %d \n" , nID );  }