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 |
|
Stan Miasnikov
|
Feb 13, 2007 - 6:12 PM
|
Hi,
I have a ribbon group that contains a button with the drop-down menu. When the Group is not collapsed it works fine and when I select a menu item the command is received by the parent window correctly. However, when this group is collapsed, I need to click on the collapsed group button, then open a menu and only then select the menu command. In this case the parent (main) window does not receive the WM_COMMAND message for the selected command. It seems that WM_COMMAND is being forwarded to a wrong parent window when the group is collapsed. It is reproducible with the RibbonPage sample. Fragment of my code that creates the group is below. I had this problem with 2.62 and still have it with 2.63.4.
Thanks,
CExtRibbonNode * CNoteRibbonMenu::InitRibbonNodeHome( bool bVisible ) { CString str, str1; CExtRibbonNodeGroup * pRibbonGroup =new CExtRibbonNodeGroup( ID_RIBBON_PAGE_HOME ); VERIFY( pRibbonGroup->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( ID_FILE_SAVE_BIG ) ) ); pRibbonGroup->m_iconBig.m_bmpNormal.Make32(); pRibbonGroup->m_iconBig.m_bmpNormal.AlphaColor( ALPHACLR1, ALPHACLR2, 0 ); VERIFY( pRibbonGroup->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( ID_FILE_SAVE_SMALL ) ) ); pRibbonGroup->m_iconSmall.m_bmpNormal.Make32(); pRibbonGroup->m_iconSmall.m_bmpNormal.AlphaColor( ALPHACLR1, ALPHACLR2, 0 ); str.LoadString( IDS_RB_HOME ); pRibbonGroup->SetTextInToolbar( str );
pRibbonGroup->RibbonILE_SetCollapsed( __EXT_RIBBON_ILE_MAX-2 ); if ( !bVisible ) pRibbonGroup->ModifyFlags( __ECTN_TBB_HIDDEN );
// CExtRibbonNodeDialogLauncher * pRibbonDLB = new CExtRibbonNodeDialogLauncher( ID_RIBBON_PAGE_HOME ); // pRibbonGroup->InsertNode( NULL, pRibbonDLB );
str.LoadString( IDS_RB_SAVENOTE ); CExtRibbonNode * pNodeSave = new CExtRibbonNode( ID_FILE_SAVENOTE, 0, NULL, 0, str ); pNodeSave->RibbonILE_RuleArrayGet().RemoveAll(); VERIFY( pNodeSave->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( ID_FILE_SAVE_BIG) ) ); pNodeSave->m_iconBig.m_bmpNormal.Make32(); pNodeSave->m_iconBig.m_bmpNormal.AlphaColor( ALPHACLR1, ALPHACLR2, 0 ); pRibbonGroup->InsertNode( NULL, pNodeSave ); pNodeSave->ModifyFlags( __ECTN_TBB_SEPARATED_DROPDOWN ); str.LoadString( IDS_RB_SAVENOTE1 ); str1 = CString("&") + str; pNodeSave->InsertNode( NULL, new CExtCustomizeCmdTreeNode( ID_FILE_SAVENOTE, ID_FILE_SAVENOTE, NULL, 0, str, str1 ) ); // separator pNodeSave->InsertNode( NULL, new CExtCustomizeCmdTreeNode ); str.LoadString( IDS_RB_IMPORTNOTE ); pNodeSave->InsertNode( NULL, new CExtCustomizeCmdTreeNode( ID_FILE_IMPORT, ID_FILE_IMPORT, NULL, 0, str ) ); str.LoadString( IDS_RB_EXPORTNOTE ); pNodeSave->InsertNode( NULL, new CExtCustomizeCmdTreeNode( ID_FILE_EXPORT, ID_FILE_EXPORT, NULL, 0, str ) ); // separator pNodeSave->InsertNode( NULL, new CExtCustomizeCmdTreeNode ); /* str.LoadString( IDS_RB_CLOSENOTE ); str1 = CString("&") + str; pNodeSave->InsertNode( NULL, new CExtCustomizeCmdTreeNode( ID_CANCEL, ID_CANCEL, NULL, 0, str1 ) ); */ str.LoadString( IDS_RB_DELETENOTE ); pNodeSave->InsertNode( NULL, new CExtCustomizeCmdTreeNode( ID_FILE_DELETE, ID_FILE_DELETE, NULL, 0, str ) );
// separator // pRibbonGroup->InsertNode( NULL, new CExtRibbonNode );
str.LoadString( IDS_RB_PROTECTNOTE ); CExtRibbonNode * pNodeProtect = new CExtRibbonNode( ID_FILE_PROTECT, 0, NULL, 0, str ); // pNodeProtect->RibbonILE_RuleRemoveLargeILV(); VERIFY( pNodeProtect->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( ID_PROTECT_BIG ) ) ); pNodeProtect->m_iconBig.m_bmpNormal.Make32(); pNodeProtect->m_iconBig.m_bmpNormal.AlphaColor( ALPHACLR1, ALPHACLR2, 0 ); VERIFY( pNodeProtect->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_PROTECT_SMALL ) ) ); pNodeProtect->m_iconSmall.m_bmpNormal.Make32(); pNodeProtect->m_iconSmall.m_bmpNormal.AlphaColor( ALPHACLR1, ALPHACLR2, 0 ); pRibbonGroup->InsertNode( NULL, pNodeProtect );
str.LoadString( IDS_RB_SENDMAIL ); CExtRibbonNode * pNodeMail = new CExtRibbonNode( ID_FILE_MAIL, 0, NULL, 0, str ); // pNodeMail->RibbonILE_RuleRemoveLargeILV(); VERIFY( pNodeMail->m_iconBig.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE( ID_SENDMAIL_BIG ) ) ); pNodeMail->m_iconBig.m_bmpNormal.Make32(); pNodeMail->m_iconBig.m_bmpNormal.AlphaColor( ALPHACLR1, ALPHACLR2, 0 ); VERIFY( pNodeMail->m_iconSmall.m_bmpNormal.LoadBMP_Resource( MAKEINTRESOURCE(ID_SENDMAIL_SMALL ) ) ); pNodeMail->m_iconSmall.m_bmpNormal.Make32(); pNodeMail->m_iconSmall.m_bmpNormal.AlphaColor( ALPHACLR1, ALPHACLR2, 0 ); pRibbonGroup->InsertNode( NULL, pNodeMail );
return pRibbonGroup; }
|
|
Stan Miasnikov
|
Feb 19, 2007 - 1:19 PM
|
It is working now, however, there is another issue: if the goup contains a button with drop-down menus and is collapced, then, when closing a menu the application assers inside of the CWnd::AssertValid() method in the wincode.cpp (line 882). Basically it happens in CWnd::GetTopLevelParent() that is called in the standard PreTranslateMessage(MSG* pMsg) method for the main application window. I can ignore this ASSERT and it still works. I do not know if this problem was before I’ve implemented the changes you have suggested, but it is there now. If the group is not collapsed then this
|
|
Technical Support
|
Feb 22, 2007 - 3:41 AM
|
Thank you for reporting the assertion failure. We will fix it as soon as possible.
|
|
Technical Support
|
Feb 14, 2007 - 11:28 AM
|
Thank you for reporting the problem. To fix it, please update the following method in ../Prof-UIS/Src/ExtPopupMenuWnd.cpp : void CExtPopupMenuWnd::_EndSequence(
UINT nCmdID, // = 0
HWND hWndDeliver // = NULL
)
{
__PROF_UIS_MANAGE_STATE;
ASSERT_VALID( this );
HWND hWndOwn = GetSafeHwnd();
ASSERT( hWndOwn != NULL );
bool bCustomizeMode = _FindCustomizeMode();
if( (! _IsFadeOutAnimation() )
&& m_ctrlShadow.GetSafeHwnd() != NULL
)
m_ctrlShadow.DestroyWindow();
#ifdef _DEBUG
if( hWndDeliver != NULL )
{
ASSERT( ::IsWindow(hWndDeliver) );
}
#endif // _DEBUG
ASSERT( m_hWndCmdReceiver != NULL );
ASSERT( ::IsWindow(m_hWndCmdReceiver) );
CExtPopupMenuSite & _site = GetSite();
UINT * lpnResultCmdID = _site.GetTargetCmdIdPtr();
if( lpnResultCmdID != NULL )
*lpnResultCmdID = nCmdID;
DWORD dwTrackFlags = TrackFlagsGet();
CExtCmdItem * pCmdItem = NULL;
if( nCmdID > 0 && ((dwTrackFlags&TPMX_NO_WM_COMMAND)==0) )
{
pCmdItem =
g_CmdManager->CmdGetPtr(
g_CmdManager->ProfileNameFromWnd( m_hWndCmdReceiver ),
nCmdID
);
//ASSERT( pCmdItem != NULL );
} // if( nCmdID > 0 && ((dwTrackFlags&TPMX_NO_WM_COMMAND)==0) )
CExtPopupMenuWnd * pTopPopup = _site.GetInstance();
ASSERT_VALID( pTopPopup );
HWND hWndTopPopup = pTopPopup->GetSafeHwnd();
ASSERT(
hWndTopPopup != NULL
&& ::IsWindow( hWndTopPopup )
);
if( hWndDeliver == NULL )
hWndDeliver = m_hWndCmdReceiver;
CWnd * pTopLevelParent = GetTopLevelParent();
HWND hWndTopLevelParent = pTopLevelParent->GetSafeHwnd();
CRect rcBkUpdate( 0, 0, 0, 0 );
// hide all sequence
bool bFadeOut = _IsFadeOutAnimation();
if( ! bFadeOut )
{
CExtPopupMenuWnd * pPopup = this;
for( ; pPopup != NULL; pPopup = pPopup->m_pWndParentMenu )
{
ASSERT_VALID( pPopup );
ASSERT( pPopup->GetSafeHwnd() != NULL );
ASSERT( ::IsWindow( pPopup->GetSafeHwnd() ) );
CRect rcPopup;
pPopup->GetWindowRect( &rcPopup );
if( rcBkUpdate.IsRectEmpty() )
rcBkUpdate = rcPopup;
else
{
CRect rcPrev( rcBkUpdate );
rcBkUpdate.UnionRect( &rcPrev, &rcPopup );
}
CExtPopupMenuTipWnd & _tipWnd = pPopup->GetTip();
if( _tipWnd.GetSafeHwnd() != NULL
&& ::IsWindow( _tipWnd.GetSafeHwnd() )
&& _tipWnd.IsWindowVisible()
)
{
CRect rcToolTip;
_tipWnd.GetWindowRect( &rcToolTip );
CRect rcPrev( rcBkUpdate );
rcBkUpdate.UnionRect( &rcPrev, &rcToolTip );
}
pPopup->ShowWindow( SW_HIDE );
} // for( ; pPopup != NULL; pPopup = pPopup->m_pWndParentMenu )
if( ! g_PaintManager.m_bIsWin2000orLater )
CExtPaintManager::stat_PassPaintMessages();
// allow bottom windows repaint
if( !rcBkUpdate.IsRectEmpty()
&& hWndTopLevelParent != NULL
&& ::IsWindow(hWndTopLevelParent)
)
{
::ScreenToClient(
hWndTopLevelParent, (LPPOINT)&rcBkUpdate);
::ScreenToClient(
hWndTopLevelParent, ((LPPOINT)&rcBkUpdate)+1
);
}
} // if( ! bFadeOut )
if( m_hWndNotifyMenuClosed != NULL
&& ::IsWindow( m_hWndNotifyMenuClosed )
)
::SendMessage(
m_hWndNotifyMenuClosed,
g_nMsgNotifyMenuClosed,
WPARAM(nCmdID),
LPARAM( this )
);
// top popup (and all children) finally must be closed
if( ! bFadeOut )
{
if( ::IsWindow( hWndTopPopup ) )
::PostMessage( hWndTopPopup, WM_CLOSE, 0, 0 );
CExtToolControlBar::_CloseCustomMenusAll();
if( CExtToolControlBar::g_bMenuTracking )
CExtToolControlBar::_CloseTrackingMenus();
} // if( ! bFadeOut )
bool bOwnWindowExist = ::IsWindow( hWndOwn ) ? true : false;
if( ::IsWindow( hWndDeliver )
&& (! bCustomizeMode )
)
{
if( pCmdItem != NULL )
{
// if command target still exists -> deliver command to it
if( (dwTrackFlags&TPMX_NO_WM_COMMAND)==0 )
{
if( ! bFadeOut )
_site.DoneInstance();
VERIFY( pCmdItem->Deliver( hWndDeliver ) );
}
} // if( pCmdItem != NULL )
else
{
if( bOwnWindowExist
&& bFadeOut
&& m_nCurIndex >= 0
&& ItemGetInfo( m_nCurIndex ).IsPopup()
)
{
CExtPopupMenuWnd * pPopup = ItemGetInfo( m_nCurIndex ).GetPopup();
if( pPopup->GetSafeHwnd() != NULL )
{
INT nSaved = pPopup->m_nFadeOutAnimationStepCount;
if( nCmdID == 0 )
pPopup->m_nFadeOutAnimationStepCount = -1;
pPopup->_EndSequence( nCmdID, hWndDeliver );
pPopup->m_nFadeOutAnimationStepCount = nSaved;
return;
}
}
if( (dwTrackFlags&TPMX_NO_WM_COMMAND) == 0
&& nCmdID != 0
)
::PostMessage(
hWndDeliver,
WM_COMMAND,
WPARAM(nCmdID),
0L
);
} // else from if( pCmdItem != NULL )
g_SoundPlayer->PlaySound(
CExtSoundPlayer::__ON_MENU_CMD_CLICKED
);
} // if( pCmdItem != NULL && ...
if( ! bOwnWindowExist )
return;
if( bFadeOut )
DestroyWindow();
else
_site.DoneInstance();
}
|
|