I would like make a quick non-closable modal dialog, that pops up while do some tasks and goes away when tasks finish.
There are some inherent difficulties:
- Don't block the main UI thread;
- Don't leave system ghosts windows;
- Move tasks to running into a separate thread;
- Allow update the waiting message to the user;
- Handling exceptions from thread to the application;
- Show animated GIF in the dialog;
How to get around these pitfalls?
Below, a practical example of how I would use it:
TWaiting.Start('Waiting, loading something...');
try
Sleep(2000);
TWaiting.Update('Making something slow...');
Sleep(2000);
TWaiting.Update('Making something different...');
Sleep(2000);
finally
TWaiting.Finish;
end;
Sleep(2000)
is the problem. Don't block the main UI thread. You'll need to move the long running tasks into a separate thread. – David HeffernanTWaiting
useCreateWindow()
(WinAPI) to create the dialog and controls on it. It might work? – dipold