We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Selection problems

Thread ID:

Created:

Updated:

Platform:

Replies:

4470 May 14,2003 05:39 PM UTC May 15,2003 11:48 AM UTC WinForms 2
loading
Tags: GridControl
Terry Foster
Asked On May 14, 2003 05:39 PM UTC

Hello, I've created a virtual tree grid based on the sample project you provide ('VirtTreeGrid') and noticed that in both my grid and the sample a selection cannot be initiated when the first cell clicked on is one of the cells that uses the 'TreeCellModel'. What can I do get around this? Thanks, Terry

Administrator [Syncfusion]
Replied On May 14, 2003 07:25 PM UTC

The OnHitTest returns a nonzero anytime the mouse is over one of the treecells. This means the selection mouse controller that manages selecting cells does not get a crack at selecting things. So, if you want to allow selections, you will have to refine teh OnHitTest to only return a nonzero when you do not want the selection controller to handle things. Below is a snippet that returns a non-zero only if the mouse is over the cell bitmap.
protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller) 
{
	if(e.Button != MouseButtons.None )
	{
		Rectangle rect = GetCellBoundsCore(rowIndex, colIndex);
		int X = rect.X + IndentSize * (int)this.Grid.Model[rowIndex, colIndex].Tag;
		rect.X = X;
		rect.Width = this.bitmapWidth;
		rect.Height = this.bitmapHeight;
		if(rect.Contains(new Point(e.X, e.Y)))
		{
			return GridHitTestContext.Cell; 
		}
		return 0;
	}
}

Terry Foster
Replied On May 15, 2003 11:48 AM UTC

Awesome - thanks! Terry

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;