* * *

Author Topic: [SOLVED] About Barcode.pas  (Read 1500 times)

Kevinn33

  • New member
  • *
  • Posts: 26
[SOLVED] About Barcode.pas
« on: April 03, 2018, 03:55:30 pm »
hello, i am new to pascal and lazarus,
i wonder why i cant view the barcode that was generated, the source is from here(pict)

Code: Pascal  [Select]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, LR_BarC, Forms, Controls, Graphics, Dialogs,
  9.   StdCtrls,barcode, LR_Class, LR_View;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     Button1: TButton;
  17.     frBarCodeObject123: TfrBarCodeObject;
  18.     frPreview1: TfrPreview;
  19.     Label1: TLabel;
  20.     procedure Button1Click(Sender: TObject);
  21.   private
  22.  
  23.   public
  24.  
  25.   end;
  26.  
  27. var
  28.   Form1: TForm1;
  29.  
  30. implementation
  31.  
  32. {$R *.lfm}
  33.  
  34. { TForm1 }
  35.  
  36. procedure TForm1.Button1Click(Sender: TObject);
  37. begin
  38.    frBarCodeObject123:= TfrBarCodeObject.Create(self);
  39.    label1.Caption:= '123';
  40. end;
  41.  
  42. end.
  43.  
« Last Edit: April 04, 2018, 12:44:59 am by Kevinn33 »

GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: about Barcode.pas
« Reply #1 on: April 03, 2018, 05:14:29 pm »
Did you try: ($LazarusDir)/components/lazreport/samples/barcode/ ?

Kevinn33

  • New member
  • *
  • Posts: 26
Re: about Barcode.pas
« Reply #2 on: April 03, 2018, 06:03:07 pm »
@GetMem, Tried but i dont want to use its report
i just want to show the barcode, then the next step will be print it.

well i got it fixed
Code: Pascal  [Select]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, LR_BarC, Forms, Controls, Graphics, Dialogs,
  9.   StdCtrls, ExtCtrls,barcode, LR_Class, LR_View;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     Button1: TButton;
  17.     frBarCodeObject123: TfrBarCodeObject;
  18.     frPreview1: TfrPreview;
  19.     Label1: TLabel;
  20.     PaintBox1: TPaintBox;
  21.     procedure Button1Click(Sender: TObject);
  22.   private
  23.  
  24.   public
  25.  
  26.   end;
  27.  
  28. var
  29.   Form1: TForm1;
  30.  
  31. implementation
  32.  
  33. {$R *.lfm}
  34.  
  35. { TForm1 }
  36.  
  37. procedure TForm1.Button1Click(Sender: TObject);
  38. var
  39.   Barcode : TBarcode;
  40. begin
  41.      Self.Caption:='123123';
  42.      Barcode := TBarcode.Create(Text);
  43.      Text:='12345';
  44.      Label1.Caption:='berhasil';
  45.      Barcode.Height:= 20;
  46.  
  47.      Barcode.DrawBarcode(PaintBox1.Canvas);
  48.  
  49.  
  50. end;
  51.  
  52. end.
  53.  

But i still cant change the barcode number.. it shows 000000000, and i dont understand what is -> self

Bart

  • Hero Member
  • *****
  • Posts: 3115
    • Bart en Mariska's Webstek
Re: about Barcode.pas
« Reply #3 on: April 03, 2018, 06:29:32 pm »
... and i dont understand what is -> self

From that I read: I really have no clue about the language I use now...

Bart

GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: about Barcode.pas
« Reply #4 on: April 03, 2018, 06:54:03 pm »
If you don't want to use reports try this: http://wiki.freepascal.org/LazBarcodes

Kevinn33

  • New member
  • *
  • Posts: 26
Re: about Barcode.pas
« Reply #5 on: April 03, 2018, 07:12:32 pm »
@Bart  :D :D :D yeah .-. i'm new to this,
i've just learn from afew piece of program..

maybe if you could help with where i can study from first?

tried lazbarcodes, but it appears only show QR codes, no source telling that i can do 1D codes,

saw this post ending, looks convincing but dont understand most of it

GetMem

  • Hero Member
  • *****
  • Posts: 3195
Re: about Barcode.pas
« Reply #6 on: April 03, 2018, 07:59:54 pm »
@Kevinn33
I'm out of ideas....

1. Please take a look at this example(package lazbarcodes): http://forum.lazarus.freepascal.org/index.php/topic,29997.msg190460.html#msg190460
2. If lazbarcodes is not what are you looking for, there is one more package you can try, but first you must uninstall lazbarcode to prevent duplicated unit error: https://packages.lazarus-ide.org/Barcodes.zip (see attached image)

Kevinn33

  • New member
  • *
  • Posts: 26
Re: about Barcode.pas
« Reply #7 on: April 04, 2018, 12:44:04 am »
I would like to say many thanks @GetMem  :) :D

thats exactly what I wanted, Simple and easy to use
I wonder why I cant search it anywhere for that
« Last Edit: April 04, 2018, 12:45:40 am by Kevinn33 »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus