Recent

Author Topic: I need to print labels (Form) with 1xLabel and 1xBarcodeQR [SOLVED]  (Read 14163 times)

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1272
Re: I need to print labels (Form) with 1xLabel and 1xBarcodeQR
« Reply #15 on: July 15, 2013, 09:44:45 am »
hello tmac1959,

what are your versions of lazarus, lazreport, lazbarcodes ? What is your O.S ?

try to use the report which is in the package lazreport sample barcode report folder and add a picture object in the master data of this report.


Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

tmac1959

  • New Member
  • *
  • Posts: 22
Re: I need to print labels (Form) with 1xLabel and 1xBarcodeQR
« Reply #16 on: July 15, 2013, 10:15:32 am »
Hello, everything I posted earlier but that it will not.

I canceled Fortes Report and pulled by your advice LazReport. QR Code is OK but I am not able to insert a local variable, for example. Variable1 (Edit1 Form1 form) containing the text of the QR Code in the Edit field LazReports Memo1 example, something like

frReport1.Memo1.Text: = Form1.Edit1.Text

You do not know how to do it, this is the last of this fight :)


Tomas
OS : Windows 7 32 bit or Windows XP 32 bits
Laz: Lazarus 1.0.10 r41613 FPC 2.6.2 i386-win32-win32/win64

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1272
Re: I need to print labels (Form) with 1xLabel and 1xBarcodeQR
« Reply #17 on: July 15, 2013, 01:10:43 pm »
in the report put a new rectangle object. In the memo zone of this object write :

Code: [Select]
MyLabel :  [MyLabel]
(MyLabel : is a permanent label, [MyLabel] is the name of the parameter)

in the ongetvalue event procedure of the frreport put this code :

Code: [Select]
if ParName = 'MyLabel' then
ParValue := Edit1.Text;

if you don't understand look at the lazreport sample stringgrid
« Last Edit: July 15, 2013, 01:12:37 pm by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

tmac1959

  • New Member
  • *
  • Posts: 22
Re: I need to print labels (Form) with 1xLabel and 1xBarcodeQR [SOLVED]
« Reply #18 on: July 15, 2013, 03:32:34 pm »
Thank you very much it helped me

Tomas
OS : Windows 7 32 bit or Windows XP 32 bits
Laz: Lazarus 1.0.10 r41613 FPC 2.6.2 i386-win32-win32/win64

songwutk

  • Newbie
  • Posts: 1
Re: I need to print labels (Form) with 1xLabel and 1xBarcodeQR
« Reply #19 on: October 07, 2021, 06:01:32 am »
tips and tricks    ;D :
How to add Qrcode barcode in the sample project barcode (cb.lpi)  of lazreport  ( the value of the qrcode is the Author field from the database disco.dbf).

1 - Install the packages lazreport and lazbarcodes in your lazarus ide.
2 - In the main form of the sample project barcode add a TbarcodeQR component.
3 - In the report add a picture where you want to display the barcode/
4 - Add this code on the event OnEnterRect of the frReport1 component :
Code: [Select]
procedure TForm1.frReport1EnterRect(Memo: TStringList; View: TfrView);
var
tmp : TBitmap;
w,h : integer;
r : TRect;
begin
  if (View.Name='Picture1')  then
  begin
    // Fields[0] --> Author
    BarCodeQR1.Text := frDBDataSet1.DataSet.Fields[0].AsString;
    BarCodeQR1.Update;
    w := BarCodeQR1.Width;
    h:= BarCodeQR1.Height;
    r:= Rect(0,0,w,h);
    tmp:=TBitmap.Create;
    tmp.Width:=w;
    tmp.Height:=h;
    // copy the qrcode bitmap  in the picture Picture1
    tmp.Canvas.CopyRect(r, BarCodeQR1.Canvas, r);
    TFrPictureView(View).Picture.Bitmap.Assign(tmp);
    tmp.free;
  end;
end;
in attachment the modified project ( the name of the report is qrcodebar.lrf )

Friendly, J.P

Thanks for awesome code.

 

TinyPortal © 2005-2018