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.

need to move cursor within the cell

Thread ID:

Created:

Updated:

Platform:

Replies:

47789 Aug 11,2006 11:50 AM Aug 14,2006 12:58 PM Windows Forms 2
loading
Tags: GridControl
Irina Jouk
Asked On August 11, 2006 11:50 AM

Hi,

I have a grid and a grouping control. For both of them there is a cell to enter a decimal number in a "#.0" format.
Is there a way to move cursor within the cell to another position?
For example:
Let’s say we have a value 11.4 in the cell. Then user types dot after the first “1”, i.e current value is getting “1.1.4” and at that moment I need to move cursor after the decimal point, i.e to have “11.(here is cursor)4”. If I just remove first dot or put some other logic to have correct value in the cell, it still keeps cursor at the position where user types the dot but not after the decimal point.
Another example, when user types the dot right before the decimal point. When I remove the dot, the cursor still stays before decimal point, but should stay after it.

Thanks in advance,
Irina

Administrator [Syncfusion]
Replied On August 14, 2006 12:51 AM

Hi Irina,

You can access the GridTextBoxCellRenderer and can move the cursor positioin using SelectionStart property of TextBoxCell. Here is a code snippet

private void gridl1_TableControlCurrentCellKeyPress(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlKeyPressEventArgs e)
{
if( e.Inner.KeyChar == ''.'')
{
Console.WriteLine("Dot pressed");
e.Inner.Handled = true;
GridTextBoxCellRenderer render = e.TableControl.CurrentCell.Renderer as GridTextBoxCellRenderer;
if( render != null)
{
render.TextBox.SelectionStart = 3;
render.TextBox.SelectionLength = 0;
}
}
}

Let me know if this helps.
Regards,
Haneef

Irina Jouk
Replied On August 14, 2006 12:58 PM

Thanks very much Haneef. It helped

Irina


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.

;