Home Forums WinForms controls Xceed Grid for WinForms Custom CellEditorManager how to handle TAB/ESC key ?

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

    I have a grid with :
    – a comment column (default xceed text editor is used)
    – a column which has a specific cell editor manager. (template control is TotoControl)

    The comment column is bound to “Commentaire” member of the current row’s object. I manage to edit the content of the cell, it persists when I hit enter or tab, and cancels when i press escape.
    What i can see with Reflector is that ESC key is handled in the GridControl and EndEdit(false) is called in your CellEditorManagerCore. Enter or Tab key triggers EndEdit(true) I guess.

    My problem comes with my custom editor. I have SelectedItem property of the control bound to “Toto” member of the current object bound to the current row. The component works as it should, the SelectedItem is set in Toto member when my mouse clicks the next cell.

    But I can’t manage to get ESC key working and cancel current editing (Maybe the ESC is not handled on the grid since focus is on my template control ?). Tabulation key works in the way that it selects “next control” and the focus comes back to the grid. My problem is to get ESC key working and cancels current edition. Is it possible ? (By handling key down on my control and sending it to the grid ?)

    Imported from legacy forums. Posted by Charles (had 2636 views)

    User (Old forums)
    Member
    Post count: 23064

    Normally, the Escape is handled by the grid, and thus the edition should cancel itself.

    It would seems that something in the custom editor is “getting” in the way. Do you override the ProcessCmdKey? Anything special you are doing in the derived classed?

    Imported from legacy forums. Posted by André (had 297 views)

    User (Old forums)
    Member
    Post count: 23064

    You are right, I am overriding ProcessCmdKey, and I was doing it wrong ! Meaculpa. The custom editor was returning true or false depending of the key pressed and was not doing/returning the base.ProcessCmdKey(ref msg, keyData); at the end.

    It’s working perfectly now, thanks for the advice and sorry about that.

    Imported from legacy forums. Posted by Charles (had 3671 views)

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