Cocoa: allow dismissing Message/Error NSAlerts using Escape key.

This commit is contained in:
whitequark 2016-06-02 02:21:16 +00:00
parent d13e29cdaf
commit e78edd9b94

View File

@ -1092,6 +1092,7 @@ bool TextEditControlIsVisible(void) {
void SolveSpace::DoMessageBox(const char *str, int rows, int cols, bool error) {
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:(error ? NSWarningAlertStyle : NSInformationalAlertStyle)];
[[alert addButtonWithTitle:@"OK"] setKeyEquivalent: @"\033"];
/* do some additional formatting of the message these are
heuristics, but they are made failsafe and lead to nice results. */