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. Image for the cookie policy date

Cells can't be edited with single cell click

I've updated to version 1.5.2.0 and now I've the following problem(s): 1.) Intention: Set the focus and edit a textbox with a single mouse click. This is what happens instead: A single mouse click causes nothing, only when I click for the second time,the focus is set to the textbox and I can change the cell value. 2.) After a change the textbox is displayed with a new style (brush pattern). If I click into the textbox nothing happens (same as point 1). The next click selects the whole textbox, although I have set AllowSelection to None. My settings are: CellType: TextBox ControllerOptions: All ActivateCurrentCellBehavior: ClickOnCell AllowSelection: None Thanks for any help Regards Kai Iske

3 Replies

AD Administrator Syncfusion Team March 6, 2003 01:16 PM UTC

Kai, I dropped a GridControl on a form, and added this form load handler.
private void Form1_Load(object sender, System.EventArgs e)
{
	this.gridControl1.ControllerOptions = GridControllerOptions.All;
	this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.ClickOnCell;
	this.gridControl1.AllowSelection = GridSelectionFlags.None;

	this.gridControl1[1,1].Text = "Some Text";
	this.gridControl1[2,2].Text = "Some Text";
}
With such a simple project, things seem to work as expected. If you try this, do things work for you? What other settings/events/overrides are you using that might affect this? Can you post a sample showing the problem? Or, maybe submit a Direct Trac incident and post a project there. -Clay


KI Kai Iske March 7, 2003 09:30 AM UTC

Hi Clay, i tried your version and I must agree, it's working correctly. Maybe the correct mouse click behaviour is just another single mouse click away. I'll do another few tests. But with the style set to a brush pattern, it is not working as expected. If a click into the cell with the background pattern, the whole cell is selected and I can't read the text. Source code follows: private void Form1_Load(object sender, System.EventArgs e) { GridBaseStyle styleLabelChange = new GridBaseStyle("Change",false); styleLabelChange.StyleInfo.Interior = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.PatternStyle.Percent60, System.Drawing.Color.White, Color.FromArgb(64, 10, 36, 106)); gridControl1.BaseStylesMap.AddRange(new GridBaseStyle[]{styleLabelChange}); this.gridControl1.ControllerOptions = GridControllerOptions.All; this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.ClickOnCell; this.gridControl1.AllowSelection = GridSelectionFlags.None; this.gridControl1[1,1].Text = "Some Text"; this.gridControl1[2,2].Text = "Some Text"; gridControl1.ChangeCells(GridRangeInfo.Cells(2,2,2,2),gridControl1.BaseStylesMap["Change"].StyleInfo,StyleModifyType.Override); } Regards, Kai Iske


AD Administrator Syncfusion Team March 7, 2003 01:44 PM UTC

Did you not see this behavior with 1.5.1.1? I don't think this has changed. The reason is that the active control is a Windows Forms RichTextBox, and that does not support alpha blending. One approach to this is dynamically swap out this style when the cell starts to be edited. You can do this in a PrepareViewStyleInfo handler.
Syncfusion.Drawing.BrushInfo whiteBrushInfo;

....
whiteBrushInfo = new Syncfusion.Drawing.BrushInfo(Color.White);   

private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(e.ColIndex == cc.ColIndex && e.RowIndex == cc.RowIndex && cc.IsEditing)
	{
		if(e.Style.Interior.BackColor.A > 0)
			e.Style.Interior = whiteBrushInfo;
	}
}           
 

Loader.
Live Chat Icon For mobile
Up arrow icon