[Lazarus] Smooth scrolling label (marquee)

Michael Schnell mschnell at lumino.de
Tue Nov 10 12:51:28 CET 2015


On 11/10/2015 12:30 PM, Luca Olivetti wrote:
> - it is very cpu intensive (I have to put it over a picture, so the 
> invalidate will also force the repainting of the bitmap I guess)
The only cure for this is using the graphic processor: only once create 
a wide pixel array from the text and then use Direct X (Open GL or 
similar API) to display part of the text "behind" in a rectangle.



>
> - the minimum timer interval is 10ms, and even that it's not 
> guaranteed (the resolution on windows is around 15ms and I got a very 
> different speed of the label using 10ms under virtualized windows xp 
> and a real windows 7 machine)
>
> - with such a low value (10ms) sometimes the application gets bogged 
> down, specifically it cannot process the modal dialog I use to shut 
> down the application.
What you are trying to do is a multimedia application and hence "soft 
realtime". This can't decently be done with "normal" desktop-Type 
paradigms.


>
> - I solved the flickering by setting DoubleBuffered to the containing 
> widget (a TPageControl), but, again, I think that takes its toll on 
> cpu usage.
see above.

> I tried to use a thread (with synchronize) instead of a ttimer to 
> obtain a lower interval, but that only compounds the problems.
  Obviously


> Any suggestion

A thing that we (company) do for a similar application (moving text 
"behind" a rectangle) is programming the "movie" in Adobe Flash and have 
the flash player show it on the screen (multiple instances). Works great !

A new development supposedly should avoid Flash (as support for same is 
dying out) and use HTML4 instead.


-Michael




More information about the Lazarus mailing list