Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
405
Disable escape key
posted

Hi there,

Is there a way to disable the default action of the 'esc' key?

They user wants to be able to hit the key once to undo the last change but not undo all changes when they hit the button twice.

Can I change the default behavior somehow, or do I have to capture the keystroke and handle it that way?

  • 469350
    Suggested Answer
    Offline posted

    Hi,

    Yes, there is a way. :)

    All keyboard behavior in the grid (and in almost all of the Infragistics WinForms controls) is controlled by the KeyActionMappings. So you could find the mapping that is responsible for canceling the whole row and remove it from the collection to turn this off.

    Finding the mapping and removing it is actually more work than it's worth, though, because there is an even easier way.What you can do is handle the BeforePerformAction event of the grid. This event fires any time the user performs some keyboard action like pressing Esc. So you can trap for the UndoRow action, and cancel it by setting e.Cancel to true.