Hi everybody,
I'm using Delphi 12 on Windows for Desktop applications.
I've an FMX project done in single threaded mode (classical without threads) with timers and I have a problem with animation of objects inside frames!
The project is structured like that :
A main form with 2 timers and 3 layouts (Top, Main, Bottom).
1 - The first timer is in charge to display successively TFrames regarding a process inside the layouts
2 - The second one is in charge of the standby mode management
A second form with 5 timers in charge of the communication with a PLC
1 - The 5 timers have different frequencies in order to read different values of the PLC (500 ms, 1s, 1.5s, etc)
In the main form, on specifics frames, I've some objects (like TArc or TRectangle, etc.) that are animated by using TFloatAnimation. My problem is that these animations are lagging.
Trying to analyse the problem I made a try without timers and it seems to work smoothly but it is hard to conclude if it is only the timers!
I would like to create some threads to eliminate the timers and my idea is to create one thread by frequency of reading.
But when I will call the method to read from the "Execute" function of the thread, the method called will be located inside the second form in a specific class (but the method is not located in a visual component of the FMX library).
So my questions are:
Should I use "Synchronize" even if the method called is not a visual component ? I'm afraid of the fact that it could slow down the application as before by the timers if each thread is all the time Synchronizing to make the different read methods calls!
To replace the 2 timers of the main thread, I imagined the use of 2 more threads to send events to the main form to let it know when it is needed to change of frame or going in standby mode. Is there a good idea?
Is there really the good approach?
I'm a little bit lost never stopping to think to do it in the better way.
Many thanks to all in advance for your contributions.