[Lazarus] animated splash screen for lengthy operation, works with windows, doesn't with linux

Luca Olivetti luca at wetron.es
Mon Mar 27 12:34:02 CEST 2023


El 27/3/23 a les 12:07, Giuliano Colla ha escrit:

> In a similar scenario my solution has been that of an horrible hack. 
> It's a hack, but it works. I've put in a corner of my window a label of 
> just one character, and, with a frequent timer (200 ms in my case) I 
> update the caption. I'm using a sequence of "-" "\" " |" "/" "-" to 
> display a rotating bar. Usually users do not even notice, but if they do 
> it's harmless. This way I trigger an event which will force a paint 
> operation, and all pending graphic updates are performed.
> 
> Maybe this works also for you. You should just tune the timer to the 
> speed of your animation.


Thank you, but I don't think it would work (at least under windows I'm 
sure it doesn't), since in order to process the timer events the main 
loop must be processing events, and it's not doing that if the program 
is stuck in a lengthy operation.
As per Sven's indication, I'm now doing all the painting in the main 
thread and delegated the lengthy operation to a thread.

Bye

-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007



More information about the lazarus mailing list