#1605 Button key binding question

sarnold Fri 5 Aug 2011

What is the prefered way to bind the Enter key press to any button ? Especially, I would like to have it bound automatically on Dialog.ok buttons.

I am missing this feature because I am developing a desktop application where I am using lots of dialogs, and pressing Enter after some input in a text field is a facility I cannot miss.

Thanks in advance for the response,

Regards

brian Fri 5 Aug 2011

You typically do it via a Command which is mapped to the button. See Dialog.commands.

sarnold Fri 5 Aug 2011

I have tested it and found that in dialogs, setting the accelerator of the Command to Key.enter does not work.

Instead, I should be doing what is done in Dialog.openPromptStr which is working: having Text.onAction listeners that close the dialog with Dialog.ok!

Regards

andy Fri 5 Aug 2011

There's a missing API for setting the default action in Dialogs, which we need to add. In the meantime, you can also try adding an onKeyDown handler to the dialog instance - and invoke Dialog.ok from there.

sarnold Fri 5 Aug 2011

Ok, thank you

Login or Signup to reply.