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.

Multiline text entry

Thread ID:

Created:

Updated:

Platform:

Replies:

32276 Jul 26,2005 11:08 AM Jul 26,2005 03:42 PM Windows Forms 4
loading
Tags: GridControl
Bill Coyle
Asked On July 26, 2005 11:08 AM

I have a virtual grid which uses resize to fit to allow for data that wraps past the end of the cell. I want to allow the user to type into a cell and have it automatically resize to accommodate the text. It almost works, but there is a problem. As the text is being entered, when it reaches the end of the line, the cell resizes to accommodate a second line, but at that point the entire text of the cell gets selected. Of course, the next character the user types replaces all of the text that he had entered so far. How can I prevent the text from being selected at that point? This doesn''t happen when the text wraps at the end of any other line but the first.

Administrator [Syncfusion]
Replied On July 26, 2005 12:40 PM

I tried to reproduce this problem in this little sample and could not see it using 3.2.1.0. Can you? http://www.syncfusion.com/Support/user/uploads/GC_AutoSize_40676c40.zip Are you doing something that might be causing he grid (and or teh embedded textbox) to lose focus? That might affect this. Are you doing anything to select all the text at some other point in your code? If you can upload a little sample showing teh problem, maybe we can suggest something.

Bill Coyle
Replied On July 26, 2005 02:08 PM

You can reproduce this behavior by adding the following line to Form1_Load in your sample: gridControl1.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll; I want the cell text to be selected when the user clicks on the cell, but I don''t want that to happen when the cell resizes.

Administrator [Syncfusion]
Replied On July 26, 2005 02:53 PM

I don''t really have a nice selution for this. You can not use that property, and manually select the text in a timer tick after a mouse click.
Timer t = null;
private void gridControl1_GridControlMouseUp(object sender, Syncfusion.Windows.Forms.CancelMouseEventArgs e)
{
	if(t == null)
	{
		t = new Timer();
		t.Interval = 30;
		t.Tick += new EventHandler(t_Tick);
	
	}
	t.Start();
}

private void t_Tick(object sender, EventArgs e)
{
	t.Stop();
	GridTextBoxCellRenderer cr = this.gridControl1.CurrentCellRenderer as GridTextBoxCellRenderer;
	if(cr != null)
	{
		
		cr.TextBox.SelectAll();
		Console.WriteLine("gridControl1_GridControlMouseUp");
	}
}

Bill Coyle
Replied On July 26, 2005 03:42 PM

Thanks. For now, I think I''ll go with the GridCellActivateAction.SetCurrent option.

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.

;