You've already forked lazarus-ccr
60 lines
963 B
ObjectPascal
60 lines
963 B
ObjectPascal
![]() |
unit main;
|
||
|
|
||
|
{$mode objfpc}{$H+}
|
||
|
|
||
|
interface
|
||
|
|
||
|
uses
|
||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, ubarcodes;
|
||
|
|
||
|
type
|
||
|
|
||
|
{ TMainForm }
|
||
|
|
||
|
TMainForm = class(TForm)
|
||
|
BarcodeQR: TBarcodeQR;
|
||
|
Timer: TTimer;
|
||
|
procedure FormCreate(Sender: TObject);
|
||
|
procedure TimerTimer(Sender: TObject);
|
||
|
private
|
||
|
|
||
|
public
|
||
|
|
||
|
end;
|
||
|
|
||
|
var
|
||
|
MainForm: TMainForm;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
{$R *.lfm}
|
||
|
|
||
|
{ 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;
|
||
|
end;
|
||
|
|
||
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||
|
var
|
||
|
w: Integer = 0;
|
||
|
h: Integer = 0;
|
||
|
begin
|
||
|
// Avoid switching to final form size while form is already visible
|
||
|
TimerTimer(nil);
|
||
|
BarcodeQR.GetPreferredSize(w, h);
|
||
|
Width := w;
|
||
|
Height := h;
|
||
|
end;
|
||
|
|
||
|
end.
|
||
|
|