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.
Unfortunately, activation email could not send to your email. Please try again.

Selection stopped working

Thread ID:

Created:

Updated:

Platform:

Replies:

16593 Jul 20,2004 11:26 AM Jul 20,2004 12:47 PM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 20, 2004 11:26 AM

I have custom modes/renderers for my row and column headers. I added code to handle mouse events and now the selection of rows, columns, table, etc isn''t working and I can''t figure out why. The code I''ve added that causes it to break is as follows: protected override void OnMouseDown(int rowIndex, int colIndex, MouseEventArgs e) { base.OnMouseDown(rowIndex, colIndex, e); if (e.Button == MouseButtons.Left) { mouseDownCell_ = new Point(colIndex, RowIndex); mouseDown_ = true; this.Grid.InvalidateRange(GridRangeInfo.Cell(rowIndex, colIndex)); } } protected override void OnMouseUp(int rowIndex, int colIndex, MouseEventArgs e) { base.OnMouseUp(rowIndex, colIndex, e); if (mouseDown_ && e.Button == MouseButtons.Left) { mouseDown_ = false; this.Grid.InvalidateRange(GridRangeInfo.Cell(rowIndex, colIndex)); } } protected override void OnMouseMove(int rowIndex, int colIndex, MouseEventArgs e) { base.OnMouseMove(rowIndex, colIndex, e); if (mouseDown_) { if (mouseDownCell_ != new Point(colIndex, RowIndex)) { mouseDown_ = false; this.Grid.InvalidateRange(GridRangeInfo.Cell(rowIndex, colIndex)); } } } protected override int OnHitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller) { if (controller != null && controller.Name == "OleDataSource") // other controllers have higher priority than me return 0; return 1; } If I comment out the code, everything works fine. What am I missing? Thanks

Administrator [Syncfusion]
Replied On July 20, 2004 11:57 AM

When you return nonzero in OnHitTest, then no other mouse controller will get the mouse actions. So, the SelectCells controller will not get a chance to do anything. So, if you want the default behavior to take place you cannot return nonzero in OnHitTest. One possible solution would be to do all the processing you want to do from OnHitTest, and just return 0. You can test Control.MouseButtons to see if a particular button is pressed in OnHitTest.

Administrator [Syncfusion]
Replied On July 20, 2004 12:13 PM

Oh, okay. So there''s no method to chain them together then or to pass the mouse events over to another controller?

Administrator [Syncfusion]
Replied On July 20, 2004 12:47 PM

You can try code like this: Syncfusion.Windows.Forms.IMouseController selectController = this.grid.MouseControllerDispatcher.Find("DragSelect"); selectController.MouseDown(e); //call mousedown Now I haven''t actually tried this so I am not 100% sure it will work as you need things to work.

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.

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.

;