+
+ // Before wxMessageDialog added support for extended message it was common
+ // practice to have long multiline texts in the message box with the first
+ // line playing the role of the main message and the rest of the extended
+ // one. Try to detect such usage automatically here by synthesizing the
+ // extended message on our own if it wasn't given.
+ if ( extendedMessage.empty() )
+ {
+ // Check if there is a blank separating line after the first line (this
+ // is not the same as searching for "\n\n" as we want the automatically
+ // recognized main message be single line to avoid embarrassing false
+ // positives).
+ const size_t posNL = message.find('\n');
+ if ( posNL != wxString::npos &&
+ posNL < message.length() - 1 &&
+ message[posNL + 1 ] == '\n' )
+ {
+ extendedMessage.assign(message, posNL + 2, wxString::npos);
+ message.erase(posNL);
+ }
+ }
+