Alert window return key operation

Hi, when creating alert windows with text entry boxes, is there any way to set the default operation of the return key, e.g. so that it triggers pressing a button you’ve added?


You can set the shortcut key of a button that you add using AlertWindow::addButton() so you can do something like:

yourAlertWindow.addButton ("MyButton", 1, KeyPress (KeyPress:returnKey, 0, 0));

and that button will be triggered when the user hits the return key.

1 Like

great, thanks!

Always worth checking the demos first for things like this - if you look in DialogsDemo.h there’s an AlertWindow with extra components that does exactly this.

1 Like