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

Synchronize Or Queue UI Updates In Tasks With Delphi XE7 Firemonkey On Android And IOS

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

Delphi XE7 Firemonkey Synchronize And Queue Tasks | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSDeveloper Malcolm Groves from Embarcadero has a blog post up with some code showing how to update your app UI from Tasks in Delphi XE7 Firemonkey. Basically Tasks use threads to get things done and you can no update the UI from a thread without causing problems. The solution for this is to use either TThread.Synchronize or TThread.Queue. What these two functions do is run the function that you pass to them in the main thread. The Synchronize function runs it in the main thread now blocking it and the Queue function with run the function at some time in the future and will not block the main thread. The blog post also has an embedded video which is a thirty minute plus tutorial on using Tasks, Futures, and parallel programming in your apps. The goal with using all of these threads, async anonymous functions, tasks, and futures is to keep your app responsive so that the user isn’t waiting needlessly. This information applies to apps for Android, IOS, OSX, and Windows. It should also compile under Appmethod.

Head over and check out the full blog post about synchronizing tasks on the main UI thread and then watch the video for in-depth parallel programming info.

Exit mobile version