David A
David A

Reputation: 821

Delphi - Control Dialog Form Show Status from a Thread

In my application I do a big quantity of task in a thread for example multiples querys to big database. I created a dialog (custom form), with a progressbar and status bar that show at final user what do you do the soft, I can synchronize the progress status with callbackmode without problems.

My problem is how I can control that this Dialog (Custom Form) show in modal until thread execute and can close when thread finalize.

Upvotes: 1

Views: 1372

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596186

Start the thread before calling ShowModal(), or have the form's OnShow event start the thread. Use the thread's OnTerminate event (which runs in the main thread) to Close() the form, which will cause ShowModal() to exit. While the thread is running, it can use TThread.Synchronize(), or custom window messages, to update the form as needed.

Upvotes: 1

Related Questions