Prevent constant size changes in native MSW wxProgressDialog

MSW implementation of wxProgressDialog adjusted the dialog size to the
size of the message shown in it on each update, resulting in visually
unpleasant constant jumping around (this is the same problem that we
used to have in wxGenericProgressDialog long time ago, see #10624).

Minimize this by using TDM_UPDATE_ELEMENT_TEXT instead of
TDM_SET_ELEMENT_TEXT for changing the element text. This still increases
the dialog size if the new element text is longer than the old value,
but at least doesn't shrink it back if it is shorter, which is already
quite an improvement.

Notice that this change requires using TDF_EXPAND_FOOTER_AREA style, as
otherwise the expanded information can't be updated without a re-layout.
But this doesn't seem to be a big loss and it's not really clear why did
we explicitly clear this flag before anyhow.

Update the dialogs sample to make it easy to test for this behaviour and
the documentation to mention MSW version peculiarities.
This commit is contained in:
Vadim Zeitlin
2017-10-27 00:01:18 +02:00
parent 6d2f903a48
commit 0736bdfb28
3 changed files with 52 additions and 10 deletions

View File

@@ -349,7 +349,20 @@ bool MyApp::OnInit()
);
for ( int i = 0; i <= PROGRESS_COUNT; i++ )
{
if ( !dlg.Update(i) )
wxString msg;
switch ( i )
{
case 15:
msg = "And the same dialog but with a very, very, very long"
" message, just to test how it appears in this case.";
break;
case 30:
msg = "Back to brevity";
break;
}
if ( !dlg.Update(i, msg) )
break;
wxMilliSleep(50);