From 4101849b4d0a4e1291e45cd990611eb9408c68a1 Mon Sep 17 00:00:00 2001 From: Andrew Radke Date: Fri, 27 Oct 2017 01:43:10 +0200 Subject: [PATCH] Grow wxGenericProgressDialog automatically if needed If the new message is longer than the previously shown one, increase the dialog size to fit it, instead of truncating the message. Still don't do anything if the new message is shorter to avoid unwanted constant changes in the dialog size if the message keeps changing. This is the original patch proposed in #10624, which it really makes sense to apply now because it makes the generic version match the behaviour of the native one under MSW (and the behaviour of the native version cannot be changed). See #10624. --- src/generic/progdlgg.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/generic/progdlgg.cpp b/src/generic/progdlgg.cpp index e61586b2c9..f1a6fcc365 100644 --- a/src/generic/progdlgg.cpp +++ b/src/generic/progdlgg.cpp @@ -765,8 +765,17 @@ void wxGenericProgressDialog::UpdateMessage(const wxString &newmsg) { if ( !newmsg.empty() && newmsg != m_msg->GetLabel() ) { + const wxSize sizeOld = m_msg->GetSize(); + m_msg->SetLabel(newmsg); + if ( m_msg->GetSize().x > sizeOld.x ) + { + // Resize the dialog to fit its new, longer contents instead of + // just truncating it. + Fit(); + } + // allow the window to repaint: // NOTE: since we yield only for UI events with this call, there // should be no side-effects