Cannot cancel out of alert window using Esc


#1

Hi, using the following code to create and run a custom alert window but can’t escape out of it, only ok/cancel work. The window works fine in all other respects but not sure if I’m doing something wrong?

AlertWindow *p_alert = new AlertWindow( "Alert", "Please enter new name", AlertWindow::AlertIconType::NoIcon );
p_alert->addTextEditor( “Name”, “” );
p_alert->addButton( "Ok", 1 );
p_alert->addButton( "Cancel", 0 );
p_alert->setEscapeKeyCancels( true );

p_alert->enterModalState( true, ModalCallbackFunction::create( [ = ]( int res ) {
...

#2

I’ve removed a check in AlertWindow::keyPressed() that was preventing the esc key from cancelling the window if any custom buttons were added so this should work as expected now.


#3

looks good, thanks