Alert window return key operation


#1

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?

thx


#2

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.


#3

great, thanks!


#4

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.