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 » select cell with right click Collapse All
Subject Author Date
Paul Cowan Sep 18, 2007 - 12:15 PM

How do I get a grid to select a cell on a right click?

Paul Cowan Sep 19, 2007 - 7:15 AM

Thanks, that worked

Suhai Gyorgy Sep 19, 2007 - 1:52 AM

I did it with a code similar to this:

bool CMyGridWnd::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
	)
{
	if ( CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent( nChar, nRepCnt, nFlags, point ) )
		return true;
 
	CExtGridHitTestInfo htInfo( point );
	HitTest( htInfo, false, true );
 
	if( !htInfo.IsHoverEmpty() && nChar == VK_RBUTTON && nRepCnt == 1 && ( nFlags & (MK_SHIFT|MK_CONTROL) ) == 0 )
	{
		SelectionSet( CPoint(htInfo.m_nColNo, htInfo.m_nRowNo) );
		return true;
	}
	return false;
}