Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Grid Tech Support » Start edit when key is pressed Collapse All
Subject Author Date
Andrew Hafer Feb 3, 2007 - 6:08 PM

Right now, the only way I can find for a user to edit a cell is for them to put the focus on that cell (either through moving there with the keyboard or clicking on it) and then clicking on the cell to put it into edit mode. In Excel, if a cell has the focus it automatically enters edit mode when you start typing. Is there any way to reproduce that functionality in Elegant Grid?

Thanks!

Technical Support Feb 4, 2007 - 10:35 AM

We will add built-in support for this feature in the next version. At the moment you can easily achieve the requested behavior by putting the following code into the GridControl.KeyPress event handler:

[C#]
private void boundGridControl1_KeyPress( object sender, KeyPressEventArgs e)
{
   if(boundGridControl1.FocusedCell != null &&
      (char.IsLetter(e.KeyChar) || char .IsNumber(e.KeyChar)))
   {
      boundGridControl1.EditFocusedCell();
      if (boundGridControl1.FocusedCell.Editing)
         SendKeys.Send(e.KeyChar.ToString());
   }
}

[VB.NET]
Private Sub boundGridControl1_KeyPress( ByVal sender As Object, ByVal e As KeyPressEventArgs) 
   If Not boundGridControl1.FocusedCell Is Nothing _
      AndAlso (Char .IsLetter(e.KeyChar) OrElse Char.IsNumber(e.KeyChar)) Then 
      boundGridControl1.EditFocusedCell()

      If boundGridControl1.FocusedCell.Editing Then 
         SendKeys.Send(e.KeyChar.ToString())
      End If 
   End If 
End Sub

Andrew Hafer Feb 4, 2007 - 10:26 PM

Thank you!