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

Caret position when entering edit mode

Thread ID:

Created:

Updated:

Platform:

Replies:

1532 Nov 8,2002 11:36 AM UTC Sep 8,2005 06:48 PM UTC WinForms 3
loading
Tags: GridControl
Teodorico Morell
Asked On November 8, 2002 11:36 AM UTC

When I have entered text in a cell and press F2, the cells enters in editing mode, but the caret is at the beginning of the text. How can I send the caret to the end of the text? Thanks.

Administrator [Syncfusion]
Replied On November 8, 2002 12:36 PM UTC

One way you can do this is to handle the CurrentCellStartEditing event and explicitly set the cursor position in the textbox.
private void gridControl1_CurrentCellStartEditing(object sender, System.ComponentModel.CancelEventArgs e)
{
	GridTextBoxCellRenderer tbr = this.gridControl1.CurrentCell.Renderer as GridTextBoxCellRenderer;
	if(tbr != null)
	{
		tbr.TextBox.SelectionStart = tbr.TextBox.Text.Length;
		tbr.TextBox.SelectionLength = 0;
	}
}

Clinton Nielsen
Replied On September 8, 2005 04:40 PM UTC

I have a related problem. What I need is for when the user clicks on the cell, the caret position is in the text at the same place where the user clicked. How would I go about doing this? thx.

Administrator [Syncfusion]
Replied On September 8, 2005 06:48 PM UTC

Try setting this property to see if it gives you what you want. this.grid.ActivateCurrentCellBehavior = GridCellActivateAction.PositionCaret

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

;