Explain that wxProgressDialog should be created on the stack

Creating it on the heap is unnecessary and can be actually harmful, so
document explicitly that it shouldn't be done.

See #17983.
This commit is contained in:
Vadim Zeitlin
2017-10-31 17:50:25 +01:00
parent 3918c420b4
commit 80ca6661d4

View File

@@ -33,6 +33,23 @@
wxProgressDialog in a multi-threaded application you should be sure to use
wxThreadEvent for your inter-threads communications).
Although wxProgressDialog is not really modal, it should be created on the
stack, and not the heap, as other modal dialogs, e.g. use it like this:
@code
void MyFrame::SomeFunc()
{
wxProgressDialog dialog(...);
for ( int i = 0; i < 100; ++i ) {
if ( !dialog.Update(i)) {
// Cancelled by user.
break;
}
... do something time-consuming (but not too much) ...
}
}
@endcode
@beginStyleTable
@style{wxPD_APP_MODAL}
Make the progress dialog modal. If this flag is not given, it is