GridControlBase

Hi, I have derived a class from GridControl which does everything I want for a light editable Grid implementation. I have read your newer help text in class GridControlBaseImp which explains the differences of GridControlBase - GridControlBaseImp -GridControl. QUESTION 1: I would like if possible to derive my class from GridControlBase. My code seems ok except I override OnColWidthsChanged OnQueryColWidth ( GridControl) Is there any equivalent functions in GridControlBase ? Question 2: From your Help : "GridControlBase... you need to manually initialize MouseControllers and cell types. " Can you remind me if there is any sample with such code or do you have any in your site ? Thanks Regards Stefan

8 Replies

AD Administrator Syncfusion Team April 14, 2005 12:55 PM UTC

similar in your derived GridControlBase. To initialize the mouse controllers, take a look at the code in C:\Program Files\Syncfusion\Essential Suite\3.0.1.0\Windows\Grid.Windows\Src\Extensions\Control\GridControlBaseImp.cs(146): protected override void InitializeMouseControllers() To initialize celltypes, you call Model.CellModels.Add for the celltypes you want to use.


ST Stefan Tsalapatis April 14, 2005 01:31 PM UTC

Thanks , But as for the first question the overridable OnColWidthsChanged OnQueryColWidth exist only in a GridControl. In GridControlBase Source I can see only private ModelRowHeightsChanged ModelColWidthsChanged Do you mean to subscribe to events Model.ColWidthsChanged Model.QueryColWidth I will do this.


AD Administrator Syncfusion Team April 14, 2005 02:51 PM UTC

Part of my response did not make it to the post. The OnColWidthsChanging methods in GridControl just wrapper methods for calling a handler for Model.ColWidthsChanging. What I was trying to suggest is that you could add the same code to your derived GridControlBase class to wrapped to a Model.ColwidthsChanging event handler.


ST Stefan Tsalapatis April 21, 2005 12:25 PM UTC

Hi, I have set the MouseControllers in a GridControlBase. (only the base controllers) But I have a problem that does not seem related to specific controllers . I had implemented in a special grid to change the row background color when the mouse hovers in another row mousemove event -> PointToRowCol ClearSelections SelectRange(row) With ControlBaseImp the above works. Not with ControlBase Regards


AD Administrator Syncfusion Team April 21, 2005 12:36 PM UTC

Exactly what fails? Can you select a range of cells with the mouse (to verify the cellselection controller is hooked up)? If you upload a sample project showing the problem, we can try to work with it here?


ST Stefan Tsalapatis April 21, 2005 01:42 PM UTC

See the sample GridControlBase1_1839.zip


AD Administrator Syncfusion Team April 21, 2005 03:01 PM UTC

The rows are not being invalidated so that is why you do not see the selections. Try this code in your GridControlBase class.
int oldRow = -1;
protected override void OnMouseMove(System.Windows.Forms.MouseEventArgs e)
{  
	int row, col;
	Point pt = new Point(e.X, e.Y);
	PointToRowCol(pt, out row, out col);
	Selections.Clear();
	Selections.SelectRange(GridRangeInfo.Row(row), true);
	if(oldRow > - 1)
		this.RefreshRange(GridRangeInfo.Row(oldRow));
	oldRow = row;
	this.RefreshRange(GridRangeInfo.Row(oldRow));
	base.OnMouseMove (e);
}


ST Stefan Tsalapatis April 21, 2005 04:08 PM UTC

Thanks Clay , it works.

Loader.
Up arrow icon