|
|
|
|
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 |
|
Robert Webb
|
Apr 14, 2009 - 10:33 PM
|
The new OnRibbonPrepareButtonContextMenu() is very useful. However, if I right-click on a ribbon tab, the CExtBarButton *button argument passed is NULL. It should point to a CExtRibbonButtonTabPage for that tab. Can you provide a fix, or a work-around so I can know which tab was licked on? Thanks, Rob.
|
|
Technical Support
|
Apr 16, 2009 - 1:56 PM
|
The CExtRibbonBar::OnRibbonPrepareButtonContextMenu() virtual method is not invoked on right mouse button click over tab buttons but the CExtRibbonBar::OnRibbonPrepareBarContextMenu() method is invoked. The CExtRibbonBar::OnRibbonPrepareButtonContextMenu() virtual method is invoked over ribbon buttons which can be inserted into the quick access toolbar. The CExtRibbonBar::OnRibbonPrepareBarContextMenu() virtual method is invoked over all the other areas.
|
|
Robert Webb
|
Apr 16, 2009 - 7:43 PM
|
Ah I see. My override of OnRibbonPrepareBarContextMenu() just called OnRibbonPrepareButtonContextMenu() with NULL for the button, hence what I saw. However, using OnRibbonPrepareBarContextMenu() still doesn’t tell me which tab was clicked on. How can I figure that out within that callback? Thanks, Rob.
|
|
Technical Support
|
Apr 17, 2009 - 10:13 AM
|
You can put the following code into your OnRibbonPrepareBarContextMenu() virtual method to determine whether a ribbon tab page button was clicked: HWND hWnd = ::WindowFromPoint( point );
if( hWnd != m_hWnd )
return true; // some popup part of ribbon is clicked
CPoint ptClient = point;
ScreenToClient( &ptClient );
INT nIdx = HitTest( ptClient );
if( nIdx < 0 )
return true; // click is not over any button
CExtBarButton * pTBB = GetButton( nIdx );
ASSERT_VALID( pTBB );
CExtRibbonButtonTabPage * pRibbonTabPageTBB = DYNAMIC_DOWNCAST( CExtRibbonButtonTabPage, pTBB );
if( pRibbonTabPageTBB == NULL )
return true; // click is not over tab page button
. . .
|
|