ProgressDialog and SetTitle()
-
Hi folks,
is it possible to update a ProgressDialog's title inside the Main() function? I'm wanting to make the title "x of y complete". Doing this doesn't work:
// pseudo code .. Main() { SetPercent(0.0); for(int i = 0; i < 100;) { String title = String("Processing i+1 of 100"); SetTitle(title); SetPercent((i + 1) / 100); ++i; } SetPercent(1.0); }
I'm guessing because Main() is on another thread. Is this possible?
WP.
-
Hi @WickedP,
The assumption would be that the execution of the main function happens too early, when there's no GUI yet available. Please, consider executing your implementation inside the PluginMessage() function, using one of the messages: C4DPL_STARTACTIVITY or C4DPL_PROGRAM_STARTED.
Let me know if you have any further questions.
Cheers,
Ilia -
Hi @i_mazlov
The dialog/gui is open. It's a progress dialog that I use to run an export function.
I did some more digging, and I believe I've solved it. I had to put the SetTitle() into the dialog's Timer() function. So, something like this:
virtual void MyProgressDialog::Timer(const BaseContainer& msg) { // 'title' is a class-level string variable SetTitle(title); return ProgressDialog::Timer(msg); }
Seems to work as expected.
WP.