Wrap wxGenericMessageDialog text to make it more readable

Prevent the text from being clipped and also improve readability by
wrapping it at (arbitrarily hard coded) 70 characters boundary.

Closes #24412.
This commit is contained in:
Jeff Young
2024-03-18 14:22:06 +01:00
committed by Vadim Zeitlin
parent e6335d6c82
commit 75c552811f
+8 -2
View File
@@ -184,6 +184,12 @@ void wxGenericMessageDialog::DoCreateMsgdialog()
wxBoxSizer * const textsizer = new wxBoxSizer(wxVERTICAL);
// To prevent clipping
int maxWidth = wxSystemSettings::GetMetric(wxSYS_SCREEN_X, this) - FromDIP(25);
// To enhance readability
maxWidth = wxMin( maxWidth, GetCharWidth() * 70 );
// We want to show the main message in a different font to make it stand
// out if the extended message is used as well. This looks better and is
// more consistent with the native dialogs under MSW and GTK.
@@ -191,7 +197,7 @@ void wxGenericMessageDialog::DoCreateMsgdialog()
if ( !m_extendedMessage.empty() )
{
wxTitleTextWrapper titleWrapper(this);
textsizer->Add(CreateTextSizer(GetMessage(), titleWrapper),
textsizer->Add(CreateTextSizer(GetMessage(), titleWrapper, maxWidth),
wxSizerFlags().Border(wxBOTTOM, 20));
lowerMessage = GetExtendedMessage();
@@ -201,7 +207,7 @@ void wxGenericMessageDialog::DoCreateMsgdialog()
lowerMessage = GetMessage();
}
textsizer->Add(CreateTextSizer(lowerMessage));
textsizer->Add(CreateTextSizer(lowerMessage, maxWidth));
icon_text->Add(textsizer, 0, wxALIGN_CENTER, 10);
topsizer->Add( icon_text, 1, wxLEFT|wxRIGHT|wxTOP, 10 );