Hello,
in an Instrumentation application I want to use the TAdvSmoothLedLabel a couple of times (4 or 5 in the form) ant update every 100ms. When I do so, the drawing takes only very few time (less than a ms - I measured with the High Resolution Stopwatch an work in Delphi XE7), but there is a lot of flickering. Is there a kind of option that support "double buffering" or something else to reduce the flickering, or is the control just not usable for my purpose ?
Thanks in advance for your help,
Heinz
Hi,
Hello Pieter,
flickering is the same with transparen true or false. In the code Fragment you see my test Routine (that just gives me some Impression how much time I Need for computing and updating). The AdvSmoothLedLabel are Default - one with transperen true and one with transparent false.
The value they display is less than 0.1 (ms) - as well for the process time as for the drawing time and s updated every 100ms.
Thanks,
Heinz
Procedure TMain.OnUpdateOnData (Var Msg: TMessage);
Begin
// Initialize Time for drawing
ProcessState.UpdateTime.UpdateStart := WzlWatch.Elapsed;
// Update the time for the computation (per 100ms) - for this cycle
With ProcessState.ProcessTime Do Begin
L1.Caption := ProcessEnd.TotalSeconds.ToString (ffFixed, 7, 2);
L2.Caption := ProcessCount.ToString;
L3.Caption := FloatToStrF (AnaInUnit[IdxAiTemp6025e], ffFixed, 5, 1); // Temperatur der Karte
L4.Caption := ProcessLast.ToString (ffFixed, 7, 3);
L5.Caption := ProcessAvg.ToString (ffFixed, 7, 3);
L6.Caption := ProcessMin.ToString (ffFixed, 7, 3);
L7.Caption := ProcessMax.ToString (ffFixed, 7, 3);
AdvSmoothLedLabel1.Caption.Value := ProcessLast;
End;
// Update the time for drawing (per 100ms) - for the previous cycle
With ProcessState.UpdateTime Do Begin
L8.Caption := UpdateLast.ToString (ffFixed, 7, 3);
L9.Caption := UpdateAvg.ToString (ffFixed, 7, 3);
L10.Caption := UpdateMin.ToString (ffFixed, 7, 3);
L11.Caption := UpdateMax.ToString (ffFixed, 7, 3);
AdvSmoothLedLabel2.Caption.Value := UpdateLast;
// Measure (and update "next" cycle) the time for drawing
UpdateEnd := WzlWatch.Elapsed;
UpdateLast := UpdateEnd.TotalMilliseconds - UpdateStart.TotalMilliseconds;
Inc (UpdateCount);
UpdateSum := UpdateSum + UpdateLast;
UpdateAvg := UpdateSum / UpdateCount;
UpdateMin := Min (UpdateLast, UpdateMin);
UpdateMax := Max (UpdateLast, UpdateMax);
End;
End;
Can you perhaps send us a sample that is able to reproduce this so we can investigate this here?
Here it is. Put a Timer on a Form and two SmoothLedLabel controls (one transparent, one not).
Here the source code (just some update every 100ms).
Unit Unit1;
Interface
Uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, AdvSmoothLedLabel;
Type
TForm1 = Class(TForm)
AdvSmoothLedLabel1: TAdvSmoothLedLabel;
Timer1: TTimer;
AdvSmoothLedLabel2: TAdvSmoothLedLabel;
Procedure Timer1Timer (Sender: TObject);
Procedure FormCreate (Sender: TObject);
Private
{ Private-Deklarationen }
Public
{ Public-Deklarationen }
End;
Var
Form1: TForm1;
SomeValue: Double = 0.0;
Implementation
{$R *.dfm}
Procedure TForm1.FormCreate (Sender: TObject);
Begin
Timer1.Enabled := True;
Timer1.Interval := 100;
End;
Procedure TForm1.Timer1Timer (Sender: TObject);
Var
SomeValue: Double;
Begin
SomeValue := Random (100) / 100;
AdvSmoothLedLabel1.Caption.Value := SomeValue;
AdvSmoothLedLabel2.Caption.Value := SomeValue;
End;
End.
Thanks for your help,
Heinz
Hello Pieter,
I had (in my original application) the control on a tabsheet (buttonstyle).
Setting the DoubleBuffered Property of the TabSheet reduced the flicker to once in a couple of seconds. Works for me now.
Thanks and sorry for not thinking more in advance.
Regards,
Heinz
Hi,