Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Build Responsive Apps With Timers And Threads Using Delphi XE6 Firemonkey On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE6 Firemonkey Asynchronous Apps Threads Background | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSMarco Cantu has a blog post up where he demonstrates various ways for building non-blocking or asynchronous apps using Delphi XE6 Firemonkey. While your app is doing work in the main thread of your application the user interface is blocked from responding to user input. Performing the operations in the background or asynchronously solves this problem. Marco shows how you can use a timer to kind of achieve background operations and leave your UI responsive to the user. Finally he shows how to use a thread (which is a better way of completing work in the background). We’ve covered threads on here before and especially the anonymous thread class which comes as an extra addon with Delphi Firemonkey. There are also some threaded dialogs you can use for when you are performing work. Some of the comments on the blog post talk about the Application.ProcessMessages; function which you can use within loops to keep your app responsive even while performing work. Generally it is considered bad to use Application.ProcessMessages; but I usually do it anyway. If you want to take advantage of multiple CPUs in your device you can do parallel processing with loops. These same ideas apply across Delphi XE5, XE6, AppMethod, Android, IOS, Windows, and OSX. Try them out and see which one works best for you.

Head over and check out the full blog post by Marco about performing operations in the background of your apps.

Exit mobile version