|
|
|
|
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 |
|
exp lnt
|
Oct 15, 2008 - 6:24 AM
|
Hello Guys, I want to show a popup menu on data grid control when clicking to the header on it. How to do this? Thank you so much !
|
|
Technical Support
|
Oct 15, 2008 - 12:33 PM
|
You should use your own CExtGridWnd -derived class which implements the CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent() following virtual method:
bool CYourGridClass::OnGbwAnalyzeCellMouseClickEvent(
UINT nChar, // VK_LBUTTON, VK_RBUTTON or VK_MBUTTON only
UINT nRepCnt, // 0 - button up, 1 - single click, 2 - double click, 3 - post single click & begin editing
UINT nFlags, // mouse event flags
CPoint point // mouse pointer in client coordinates
)
{
ASSERT_VALID( this );
ASSERT( 0 <= nRepCnt && nRepCnt <= 3 );
if( PARENT_OF_ CYourGridClass::OnGbwAnalyzeCellMouseClickEvent(
nChar,
nRepCnt,
nFlags,
point
)
)
return true;
CExtGridHitTestInfo htInfo( point );
HitTest( htInfo, false, true );
if( htInfo.IsHoverEmpty()
|| ( ! htInfo.IsValidRect() )
)
return false;
INT nColType = htInfo.GetInnerOuterTypeOfColumn();
INT nRowType = htInfo.GetInnerOuterTypeOfRow();
if( nColType == 0 && nRowType < 0 && nChar == VK_RBUTTON )
{
// The outer header cell at top is clicked with right mouse button,
// You should insert your handling code here.
return true;
}
return false;
}
|
|