DialogWrapper OK Button Enter key

Answered

Hi,

is it possible to disable the Enter key shortcut on the DialogWrapper's OK button? I need to do some actions in the dialog that require to press enter, and the dialog keeps closing :-)

0
3 comments

Hi Miloslav,

Please provide more context. What actions require pressing enter, what components are there, etc.?

0

Hi Karol,

the DialogWrapper binds keystroke ENTER to its OK button. That means, every time I press ENTER anywhere on that dialog, the window closes. I have couple of controls on this dialog window, for example integer fields, where when I edit, out of habit I press ENTER, which closes my dialog, although I'm not done editing all the others. It's annoying...

0

Thanks for the explanation. I get it now.

Enter hook is installed in DialogWrapper.installEnterHook(), and you should not change this behavior for standard components.

3rd-party plugins’ behavior should be consistent with the Platform. It would provide a bad user experience when all the dialogs close on enter, and there is one that does not. Navigating between fields should be done by Tab or Shift+Tab; I believe this is how most users work.

Consider validating fields if the dialog is not fully filled with the data.
See also:

0

Please sign in to leave a comment.