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

Add text when a cell is in edit mode

Thread ID:

Created:

Updated:

Platform:

Replies:

70017 Nov 22,2007 05:13 PM UTC Nov 22,2007 08:31 PM UTC WinForms 1
loading
Tags: GridControl
David Jung
Asked On November 22, 2007 05:13 PM UTC

I am trying to mimic the behaviour of Excel, especially the percentage cells. I want to know two things to accomplish this.

1) Is there any way to differentiate how the editing is initiated? the options are double click, key input, F2, BeginEdit() method, etc.

2) Is it possible to append text while cell is being editted. In my requirement, a percentage sign should be there when the cell gets into the edit mode



haneefm [Syncfusion]
Replied On November 22, 2007 08:31 PM UTC

Hi,

1) Is there any way to differentiate how the editing is initiated? the options are double click, key input, F2, BeginEdit() method, etc.
>>>>>>>>>>>>>>>>>>>>>>>>>

Yes, Below are the codes that shows this task.

private bool b_MouseDown = false;
void gridControl1_MouseDown(object sender, MouseEventArgs e)
{
b_MouseDown = true;
}

void gridControl1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{

KeyStateInfo Keyinfo = KeyboardInfo.GetKeyState(Keys.F2);

if ( Keyinfo.IsPressed )
{
Console.WriteLine("BeginEdit is called using the F2 Key");
}
else if (b_MouseDown)
{
Console.WriteLine("BeginEdit is called using the MouseClickButton");
}
else
Console.WriteLine("BeginEdit is called using the method");

b_MouseDown = false;
}

Please refer to the attached sample for implementation.
GridFormulaCells.zip

2) Is it possible to append text while cell is being editted. In my requirement, a percentage sign should be there when the cell gets into the edit mode
>>>>>>>>>>>>>>>>>>>>>

Yes, you can do this by using the GetEditState and SetEditState method. Here is a codes:

object obj_EditState = this.gridControl1.CurrentCell.Renderer.GetEditState();
this.gridControl1.CurrentCell.Renderer.ControlText += "%";
this.gridControl1.CurrentCell.Renderer.SetEditState(obj_EditState);

Best regards,
Haneef


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

;