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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Checkbox on mousedown only

Thread ID:

Created:

Updated:

Platform:

Replies:

14792 Jun 4,2004 10:08 AM UTC Jun 4,2004 10:45 AM UTC WinForms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 4, 2004 10:08 AM UTC

I was comparing the checkbox functionality on a standard listview and it checks the box on the mouse down and not the combination of the mouse down and mouse up. Is there anyway to make the grid controls checkbox behave the same way.

Administrator [Syncfusion]
Replied On June 4, 2004 10:45 AM UTC

The standard windows forms checkbox changes the check on mouseup. If you want change it on MouseDown, then you can try the event handler below. But there maybe undesired consequences of doing so. For example, if you mousedown on a checkbox and drag to select a range of cells, the checkbox changes. (ListView does not support this I assume.)
private void gridControl1_GridControlMouseDown(object sender, CancelMouseEventArgs e)
{
	Point pt = new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y);
	int row, col;
	if(this.gridControl1.PointToRowCol(pt, out row, out col, -1))
	{
		if(this.gridControl1[row, col].CellType == "CheckBox")
		{
			if(this.gridControl1[row, col].Text == this.gridControl1[row, col].CheckBoxOptions.CheckedValue)
				this.gridControl1[row, col].Text = this.gridControl1[row, col].CheckBoxOptions.UncheckedValue;
			else
				this.gridControl1[row, col].Text = this.gridControl1[row, col].CheckBoxOptions.CheckedValue;
	        this.gridControl1.CurrentCell.MoveTo(row, col);
			e.Cancel = true;
		}
	}
}

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

;