Author Topic: gui application with long operation  (Read 263 times)


  • Jr. Member
  • **
  • Posts: 78
gui application with long operation
« on: May 19, 2022, 03:17:38 pm »
I am almost sure this is a old topic, please suggest relevant messages if there are.

Have a GUI application with one Form, with a button. When one clicks the button a long operation starts (duration can vary from few msec to several tens of seconds).

Is there anything ready or, if not, what is the recommended approach to:

1. avoid blocking the Form
2. give a notification if the actual duration of the operation exceeds x msecs (something like a busy wait screen that appears if operation is too long)

Thank you


  • Administrator
  • Hero Member
  • *
  • Posts: 10291
  • FPC developer.
Re: gui application with long operation
« Reply #1 on: May 19, 2022, 04:48:51 pm »
If you can break up the long operation (e.g. it is a FOR loop, and you can run code every so many iterations), then you can mess around with application.processmessages. (search on the forum)

In other cases, when the code can't be interrupted in any way, moving the code to a thread is the only solution, and hope that it eventually finishes.


TinyPortal © 2005-2018