diff --git a/components/lazbarcodes/examples/qrclock/main.lfm b/components/lazbarcodes/examples/qrclock/main.lfm
index dd10f4d58..9206b7483 100644
--- a/components/lazbarcodes/examples/qrclock/main.lfm
+++ b/components/lazbarcodes/examples/qrclock/main.lfm
@@ -3,23 +3,9 @@ object MainForm: TMainForm
Height = 260
Top = 130
Width = 260
- AutoSize = True
BorderStyle = bsDialog
Caption = 'QRClock'
- ClientHeight = 260
- ClientWidth = 260
OnCreate = FormCreate
- object BarcodeQR: TBarcodeQR
- Left = 0
- Height = 260
- Top = 0
- Width = 260
- ParentColor = False
- Text = 'TBarcodeQR'
- Scale = 12
- AutoSize = True
- RecommendedSymbolSize = False
- end
object Timer: TTimer
Interval = 250
OnTimer = TimerTimer
diff --git a/components/lazbarcodes/examples/qrclock/main.pas b/components/lazbarcodes/examples/qrclock/main.pas
index ec703e402..48c1214fe 100644
--- a/components/lazbarcodes/examples/qrclock/main.pas
+++ b/components/lazbarcodes/examples/qrclock/main.pas
@@ -12,11 +12,12 @@ type
{ TMainForm }
TMainForm = class(TForm)
- BarcodeQR: TBarcodeQR;
Timer: TTimer;
procedure FormCreate(Sender: TObject);
procedure TimerTimer(Sender: TObject);
private
+ BarcodeQR: TBarcodeQR;
+ function GetNowText: String;
public
@@ -32,15 +33,9 @@ implementation
{ TMainForm }
procedure TMainForm.TimerTimer(Sender: TObject);
-var
- dt: TDateTime;
- sd, st: String;
begin
- dt := Now();
- sd := FormatDateTime('dddddd', dt);
- st := FormatDateTime('hh:nn:ss', dt);
- Caption := 'QRClock: ' + sd + ' - ' + st;
- BarcodeQR.Text := sd + LineEnding + st;
+ BarcodeQR.Text := GetNowText;
+ Caption := 'QRClock: ' + StringReplace(BarcodeQR.Text, LineEnding, ' - ', []);
end;
procedure TMainForm.FormCreate(Sender: TObject);
@@ -48,11 +43,25 @@ var
w: Integer = 0;
h: Integer = 0;
begin
- // Avoid switching to final form size while form is already visible
- TimerTimer(nil);
+ BarcodeQR := TBarcodeQR.Create(self);
+ BarcodeQR.Parent := self;
+ BarcodeQR.Scale := 16;
+ BarcodeQR.Text := GetNowText;
BarcodeQR.GetPreferredSize(w, h);
- Width := w;
- Height := h;
+ BarcodeQR.SetBounds(0, 0, w, h);
+ ClientWidth := w;
+ ClientHeight := h;
+end;
+
+function TMainForm.GetNowText: String;
+var
+ dt: TDateTime;
+ sd, st: String;
+begin
+ dt := Now();
+ sd := FormatDateTime('dddddd', dt);
+ st := FormatDateTime('hh:nn:ss', dt);
+ Result := sd + LineEnding + st;
end;
end.
diff --git a/components/lazbarcodes/examples/qrclock/qrclock.lpi b/components/lazbarcodes/examples/qrclock/qrclock.lpi
index 44db70f52..33d121c35 100644
--- a/components/lazbarcodes/examples/qrclock/qrclock.lpi
+++ b/components/lazbarcodes/examples/qrclock/qrclock.lpi
@@ -44,6 +44,7 @@
+