Home Forums WinForms controls Xceed Grid for WinForms Activating edit mode with custom key

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14034 |

    F2 is the edit mode activator key as far as I know. I would like to use Enter to begin edit in the current cell if enabled. How can I do this? It would be really good if this (along with other keys) was customizable. Grid would have an EditActivatorKey property or so. This would be a nice feature.
    Thanks

    Imported from legacy forums. Posted by szinkopa (had 2340 views)

    User (Old forums)
    Member
    Post count: 23064

    <pre>grid.KeyDown += new KeyEventHandler(gridKeyDown);
    private void gridKeyDown(object sender, KeyEventArgs e) {
    if (e.KeyCode == Keys.Enter) {
    Cell cell = grid.CurrentCell;
    if (cell != null) cell.EnterEdit();
    }
    }</pre>

    Imported from legacy forums. Posted by Tommy (had 182 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you Tommy, this works very well, except on cells that cannot be edited because of their type (for example my own class, see the other topic). The grid throws an exception in this case that it cannot convert the contents to the cell to the TextEditor’s format. Spacing or double clickcing on the cell handles this exception and does not allow to edit the cell. I will try to write a CellEditor to edit my class instance. It would be not inplace, but a separate dialog.

    Imported from legacy forums. Posted by szinkopa (had 3538 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.