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:
@@ -33,6 +33,23 @@
|
|||||||
wxProgressDialog in a multi-threaded application you should be sure to use
|
wxProgressDialog in a multi-threaded application you should be sure to use
|
||||||
wxThreadEvent for your inter-threads communications).
|
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
|
@beginStyleTable
|
||||||
@style{wxPD_APP_MODAL}
|
@style{wxPD_APP_MODAL}
|
||||||
Make the progress dialog modal. If this flag is not given, it is
|
Make the progress dialog modal. If this flag is not given, it is
|
||||||
|
Reference in New Issue
Block a user