var
MyForm,MyForm2:TclForm;
testButton,testButton2,testButton3 : TClProButton;
testLabel : TclLabel;
QRGen : TClQRCodeGenerator;
QrTimer, QrTimeTimer:TClTimer;
BtnNewQrCode:TclButton;
BtnReadQrCode:TclButton;
ReadQrEdt : TclEdit;
LblDisplay:TclLabel;
IntQROnStartVal:Extended;
QrAppType:Integer;
QrSecondLimit:Integer;
QRLabel: TclEdit;
Procedure BtnNewQrCodeClick;
begin
BtnNewQrCode.Caption := FormatDateTime('yymmdd0hhnnss', Now);
QRGen.Text := Clomosy.ProjectEncryptAES(BtnNewQrCode.Caption);
End;
Procedure OnQrTimer;
begin
QrTimeTimer.Tag := QrSecondLimit;
BtnNewQrCodeClick;
End;
Procedure SaveRecordThread;
Begin
ShowMessage('kodunuz okundu');
End;
Procedure OnGetQRCode;
var
s:String;
IntQRVal:Extended;
begin
If ReadQrEdt.Text='' Then Exit;
s := FormatDateTime('yymmdd0hhnnss', Now);
IntQROnStartVal := StrToFloat(s);
Try
s := Clomosy.ProjectDecryptAES(ReadQrEdt.Text);
ReadQrEdt.Text := s;
IntQRVal := StrToFloat(s);
Except
IntQRVal :=0;
end;
If (IntQROnStartVal-QrSecondLimit)<= IntQRVal Then
Begin
SaveRecordThread;
End Else ShowMessage('Invalid QR Code. Please complete the process within '+IntToStr(QrSecondLimit)+' seconds. Try again!');
End;
Procedure BtnReadQrCodeClick;
begin
MyForm2.CallBarcodeReaderWithScript(ReadQrEdt,'OnGetQRCode');
End;
Procedure OnQrTimeTimer;
begin
QrTimeTimer.Tag := QrTimeTimer.Tag - 1;
LblDisplay.Text := IntToStr(QrTimeTimer.Tag);
End;
procedure gonder
begin
QrAppType := 0;
QrSecondLimit := 30;
If Clomosy.PlatformIsMobile Then QrAppType := 2;
If Not Clomosy.PlatformIsMobile Then
QrAppType := 1;
IF QrAppType=1 Then
Begin
Clomosy.OpenForm(ftMembers,fdtsingle,froReadOnly, ffoNoFilter);
Exit;
End;
if Clomosy.AppUserGUID ='6MFW419738' then
QrAppType:=1;
If Clomosy.AppUserProfile=1 Then
QrAppType:=0;
MyForm2:= TCLForm.Create(Self);
LblDisplay:= MyForm2.AddNewLabel(MyForm2,'LblDisplay','--');
LblDisplay.Align := alTop;
If QrAppType=0 then
Begin
QRGen:= MyForm2.AddNewQRCodeGenerator(MyForm2,'QRGen','Hello World');
QRGen.Height := 200;
QRGen.Align := alCenter;
BtnNewQrCode:= MyForm2.AddNewButton(MyForm2,'BtnNewQrCode','Starting');
BtnNewQrCode.Align := alTop;
MyForm2.AddNewEvent(BtnNewQrCode,tbeOnClick,'BtnNewQrCodeClick');
End;
If QrAppType=2 then
Begin
BtnReadQrCode:= MyForm2.AddNewButton(MyForm2,'BtnReadQrCode','Scan the QR Code');
BtnReadQrCode.Height := 100;
BtnReadQrCode.Width := 200;
BtnReadQrCode.Align := alCenter;
MyForm2.AddNewEvent(BtnReadQrCode,tbeOnClick,'BtnReadQrCodeClick');
ReadQrEdt := MyForm2.AddNewEdit(MyForm2,'ReadQrEdt','Scan the Barcode...');
ReadQrEdt.Align := alBottom;
ReadQrEdt.ReadOnly := True;
ReadQrEdt.Visible := False;
End;
If QrAppType=0 then
Begin
QrTimer:= MyForm2.AddNewTimer(MyForm2,'QrTimer',1000*QrSecondLimit);
QrTimer.Interval := 1000*QrSecondLimit;
QrTimer.Enabled := True;
MyForm2.AddNewEvent(QrTimer,tbeOnTimer,'OnQrTimer');
QrTimeTimer:= MyForm2.AddNewTimer(MyForm2,'QrTimeTimer',1000);
QrTimeTimer.Interval := 1000;
QrTimeTimer.Tag := QrSecondLimit;
QrTimeTimer.Enabled := True;
MyForm2.AddNewEvent(QrTimeTimer,tbeOnTimer,'OnQrTimeTimer');
End;
MyForm2.Run;
end;
Procedure QRekle;
Var
S: String;
Begin
S:= QRLabel.Text;
ShowMessage(S);
End;
Procedure Ekle;
begin
MyForm.CallBarcodeReaderWithScript(QRLabel,'QRekle');
End;
begin
MyForm:=TCLForm.Create(self)
//bakground renk arka plan
MyForm.SetFormColor('#CBEDD5','#E6E2C3',clGVertical);
QRLabel:= MyForm.AddNewEdit(MyForm, 'qredit', '');
QRLabel.Visible:= False;
//button1: ürün ekleme butonu
testButton := MyForm.AddNewProButton(MyForm,'testbutton','Ürün Ekle');
clComponent.SetupComponent(testbutton,'{"caption":"Ürün Ekle","Align" : "Center","MarginTop":120,"Width" :200,
"Height":70,"RoundHeight":2,
"RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
testButton2 := MyForm.AddNewProButton(MyForm,'testButton2','Ürün Sil');
clComponent.SetupComponent(testButton2,'{"caption":"Ürün Sil","Align" : "Center","MarginBottom":135,"Width" :200,
"Height":70,"RoundHeight":2,
"RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
//button3: ürün arama butonu
testButton3 := MyForm.AddNewProButton(MyForm,'testButton3','Ürün Ara');
clComponent.SetupComponent(testButton3,'{"caption":"Ürün Ara","Align" : "Center","MarginBottom":400,"Width" :200,
"Height":70,"RoundHeight":2,
"RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
testLabel:= MyForm.AddNewLabel(MyForm,'testLabel','');
testLabel.StyledSettings := ssFamily;
testLabel.TextSettings.Font.Size:=20;
testLabel.Align := alCenter;
testLabel.Margins.Left:= 50;
testLabel.Margins.Top:= 10;
testLabel.Margins.Bottom:=500;
testLabel.Height := 50;
testLabel.Width := 150;
// qr code //
//button1 çıktısı
MyForm.AddNewEvent(testButton,tbeOnClick,'Ekle');
//button2 çıktısı
MyForm.AddNewEvent(testButton2,tbeOnClick,'ShowMessage(''Ürün Silindi'')');
//button3 çıktısı
MyForm.AddNewEvent(testButton3,tbeOnClick,'gonder');
MyForm.Run;
end;