|
|
|
|
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 |
|
Andrew Cochran
|
Jul 12, 2006 - 3:47 AM
|
Hi. I have to know wether user has made double click on the grid cell in the property window. I tried to override OnClick method and determine the fact by nChar and nRepCnt. Here is my code of function.
virtual bool OnClick( CExtGridWnd & wndGrid, const CExtGridHitTestInfo & htInfo, 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 ) { if (nChar == VK_LBUTTON && nRepCnt == 1) { AfxMessageBox(L"Single click"); } if (nChar == VK_LBUTTON && nRepCnt == 2) { AfxMessageBox(L"Double click"); } return CExtGridCellColor::OnClick(wndGrid, htInfo, nChar, nRepCnt, nFlags); }
But there is always "Single click" and "begin edit" happends, not "Double click". May be I’m doing thomething wrong? Is there any other way for me to know when the user double clicked on the cell? Please, help!
|
|
Technical Support
|
Jul 13, 2006 - 12:18 PM
|
Please update the source code of the CExtTreeGridWnd::OnGbwAnalyzeCellMouseClickEvent() method in the ExtTreeGridWnd.cpp file so you can catch double clicks in grid cells inside tree grid windows: bool CExtTreeGridWnd::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( nChar == VK_LBUTTON )
{
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
)
{
if( nRepCnt == 1 || nRepCnt == 2 )
{
if( ( ( nRepCnt == 1
&& OnTreeGridQueryColumnOutline( htInfo.m_nColNo )
&& (htInfo.m_dwAreaFlags&__EGBWA_TREE_OUTLINE_AREA) != 0
)
|| nRepCnt == 2
)
&& (htInfo.m_dwAreaFlags&(__EGBWA_CELL_BUTTON|__EGBWA_CELL_CHECKBOX)) == 0
)
{
HTREEITEM hTreeItem = ItemGetByVisibleRowIndex( htInfo.m_nRowNo );
if( ( nRepCnt == 2
&& hTreeItem != NULL
&& ItemGetChildCount( hTreeItem ) > 0
)
|| (htInfo.m_dwAreaFlags&__EGBWA_TREE_BOX) != 0
)
{
OnTreeGridToggleItemExpandedState(
htInfo.m_nRowNo,
&htInfo
);
return true;
}
}
} // if( nRepCnt == 1 || nRepCnt == 2 )
}
} // if( nChar == VK_LBUTTON && ( nRepCnt == 1 || nRepCnt == 2 ) )
if( CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent(
nChar,
nRepCnt,
nFlags,
point
)
)
return true;
return false;
}
|
|
Andrew Cochran
|
Jul 19, 2006 - 2:49 AM
|
Big THANKS!
Now it sems to work correctly!
Best regards!
|
|