leid999 0 Newbie Poster

Hi:
I have a C++ program in which I generate a window to show my progress. I design that the window will maintain until I click "OK' button on it after all process done. However, it is always automatically shut down before I can see the OK button. I tried many ways to prevent this happen, but none worked. Could some body help me to look into the following code and give me a hint to what would be the problem? Thanks a lot!

(only part program)
1. Control program:

MyProgress = new TMyProgress(this);
MyProgress->FileName->Caption = InputFile->Text.c_str();
MyProgress->ProgressBar->Max = 100;

*MyProgress is the progress window I generate.

2. Process program:
MyProgress->Show();
MyProgress->Cali->Caption = AnsiString("Model is running...");
int Percent1 = int(100*100*(double(i+1))/(double(N_ITERATIONS)));
int Percent = (double(Percent1))/100.0;
MyProgress->CaliProgressBar->Position = Percent;
MyProgress->CaliPercent->Caption = AnsiString(Percent)+" %";

*i is iteration variable from 0 to N

When iteration is over:

if (i == N-1)
{
MyProgress->Cali->Caption = AnsiString("Work is done!");
MyProgress->OKCancel->Caption = "OK";
}

I can see the progress bar and percent change over the process, but the progress window is shut down once the process is done.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.