virtualgrid combobox problems

Hi, in my virtualgrid there are combobox cells, the following code works fine void GridQueryCellInfo (object sender, GridQueryCellInfoEventArgs e) { ... e.Style.CellType = "ComboBox"; e.Style.ChoiceList = items; ... } however in my application, i also need to get the CellMouseDown/CellMouseUp events to be raised, when i handle the CellHitText event, and return a non-zero result when the mouse is over a cell where i want to get those events using following code: private void gridControl1_CellHitTest(object sender, GridCellHitTestEventArgs e) { e.Result = 1; } the comboBox does not work when i click the corresponding cell!!! any idea how to solve this problem? thanks, yan zhao

4 Replies

AD Administrator Syncfusion Team December 9, 2004 08:08 AM UTC

One way around this is to add code to your gridControl1_CellHitTest handler that tests if the cell is a combobox cell (and maybe if the mouse is over the button), and if it is, return 0 instead of 1.


YA yan December 9, 2004 09:53 PM UTC

thanks for the replying! could you please give more detail about how to know if the mouse is over the button? >One way around this is to add code to your gridControl1_CellHitTest handler that tests if the cell is a combobox cell (and maybe if the mouse is over the button), and if it is, return 0 instead of 1.


AD Administrator Syncfusion Team December 9, 2004 11:44 PM UTC

Here is some code that work for me in grid_MouseMove. You could probably use something similar in your event.
private void gridControl1_MouseMove(object sender, MouseEventArgs e)
{
	int row, col;
	Point pt = new Point(e.X, e.Y);
	if(this.gridControl1.PointToRowCol(pt, out row, out col))
	{
		if(this.gridControl1[row, col].CellType == "ComboBox")
		{
			//Console.WriteLine("xxxxOverButton");
			Rectangle rect = this.gridControl1.RangeInfoToRectangle(this.gridControl1.PointToRangeInfo(pt));
			if(rect.Right - 20 < pt.X)
			{
				Console.WriteLine("OverButton");
				//set hitest = 0;
			}

		}
	}
}


YA yan December 13, 2004 03:27 AM UTC

Thank you very much! that''s exactly what i need. >Here is some code that work for me in grid_MouseMove. You could probably use something similar in your event. >
>private void gridControl1_MouseMove(object sender, MouseEventArgs e)
>{
>	int row, col;
>	Point pt = new Point(e.X, e.Y);
>	if(this.gridControl1.PointToRowCol(pt, out row, out col))
>	{
>		if(this.gridControl1[row, col].CellType == "ComboBox")
>		{
>			//Console.WriteLine("xxxxOverButton");
>			Rectangle rect = this.gridControl1.RangeInfoToRectangle(this.gridControl1.PointToRangeInfo(pt));
>			if(rect.Right - 20 < pt.X)
>			{
>				Console.WriteLine("OverButton");
>				//set hitest = 0;
>			}
>
>		}
>	}
>}
>

Loader.
Up arrow icon