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.
Syncfusion Feedback

Cell select all text behavior when user click on it

Thread ID:

Created:

Updated:

Platform:

Replies:

96924 Oct 13,2010 03:14 PM UTC Oct 14,2010 08:13 PM UTC Windows Forms 2
loading
Tags: GridControl
Dominik.Delisle-Ong
Asked On October 13, 2010 03:14 PM UTC

Hi

When the user click on a cell to edit the text, the default behavior is to select all the text. It's a good default behavior since most of the time users expect to replace the text, but in this specific case the user expect to add text. So we would like to change that behavior so the cursor is position at the end of the text when the user click on the cell to edit it.

Is there a way to do this?

Thanks,

Dominik


Dominik.Delisle-Ong
Replied On October 14, 2010 03:45 PM UTC

Never mind, I found the solution

Just need to hook to gridControl.CurrentCellControlGotFocus, cast the control to GridOriginalTextBoxControl and update the SelectionLength and SelectionStart properties

gridControl.CurrentCellControlGotFocus += new ControlEventHandler(gridBinder_CurrentCellControlGotFocus);

...

private void gridBinder_CurrentCellControlGotFocus(object sender, ControlEventArgs e)
{
GridOriginalTextBoxControl textBoxControl = e.Control as GridOriginalTextBoxControl;
if (textBoxControl == null)
return;

textBoxControl.SelectionLength = 0;
textBoxControl.SelectionStart = textBoxControl.TextLength;
}

Thanks,

Dominik


Rajadurai C [Syncfusion]
Replied On October 14, 2010 08:13 PM UTC

Hi Dominik,

Thanks for your interest in Syncfusion Products.

You could get the SelectAll functionality in gridcell by handling the following property setting alone.

this.gridControl1.ActivateCurrentCellBehavior = GridCellActivateAction.SelectAll;


Please let us know if you have any further concerns.

Regards,
Rajadurai


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

;