* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / how to hide this in mac os
« Last post by tianya on Today at 03:19:35 pm »
how to hide this in mac os
2
Hi, I will try to avoid the dll stuff.

@GetMem, the package is to connect to a new generation of fiscal printer of my country (Argentina), and it will communicate with JSON, I will use fphttpclient in Lazarus and Indy for Delphi, as was assigned by my boos. We're using only Delphi 10.

And yes, I already have 2 units (with no code yet), but I wish to share the component (say TFiscalPrinter) between Delphi and Lazarus. The specific things for Delphi and FPC are in 2 separate units (communication with fphttpcliend and Indy, say TJSONCommunication). But with same object name, I only add an ifdef to load the correct file.
3
General / Re: Have troubles checking if a TPicture is created.
« Last post by User137 on Today at 03:15:02 pm »
Assigned() works, as you are using it. But i think the issue is more about the code that creates and frees it. You need to FreeAndNil(), doing only .Free will not be enough if the variable is used later.
4
General / Barcode.pas printing in raspberry pi stretch
« Last post by Kevinn33 on Today at 03:13:09 pm »
Hi, recently i am doing a project and it consist of a system that have to be able print a barcode in thermal printer
i use this code in lazarus windows 10 and it works great.
but then when i copy the project and do clean build, compile and run,
the program run but it wont print anybarcode that i want

Code: Pascal  [Select]
  1. unit Printertestingg;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  9.   Buttons, Printers, StBarC;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     Button1: TButton;
  17.     StBarCode1: TStBarCode;
  18.     procedure Button1Click(Sender: TObject);
  19.   private
  20.     { private declarations }
  21.     procedure PrintString(S:String);
  22.     procedure PrintSample;
  23.   public
  24.     { public declarations }
  25.   end;
  26.  
  27. var
  28.   Form1: TForm1;
  29.  
  30. implementation
  31.  
  32. {$R *.lfm}
  33.  
  34. { TForm1 }
  35. procedure TForm1.PrintString(S: String);
  36. var
  37.   Written: Integer;
  38. begin
  39.   Printer.Write(S[1], Length(S), Written);
  40. end;
  41.  
  42. const
  43.   MaxBufSize = 256;
  44.  
  45. procedure TForm1.PrintSample; // a kind of procedure
  46. begin
  47.    //Mencetak header dan isi struk
  48.    PrintString('========Selamat Datang========='+LineEnding);
  49.    PrintString('=======Penyewaan  Loker========'+LineEnding);
  50.    PrintString('Tercetak Pada '+DateTimeToStr(Now));//Menampilkan waktu sekarang
  51.    PrintString('Item : 1 Loker    = Rp. 35000,-'+LineEnding);
  52.    PrintString('==============================='+LineEnding);
  53.    PrintString('Total             = Rp. 35000,-'+LineEnding);
  54.    PrintString(LineEnding);
  55.    PrintString('  Simpan Struk pembayaran ini  '+LineEnding);
  56.    PrintString('Struk ini akan digunakan untuk '+LineEnding);
  57.    PrintString('buka loker yang digunakan      '+LineEnding);
  58.    PrintString('Barcode : '+LineEnding);
  59.  
  60. end;
  61.  
  62. procedure TForm1.Button1Click(Sender: TObject);
  63. begin
  64.   Printer.SetPrinter('POS-58');  //Deklarasi nama printer
  65.   Printer.Title := Caption;
  66.  // Printer.RawMode := True;
  67.  // Printer.BeginDoc;
  68.  // PrintSample;
  69.  // Printer.EndDoc;
  70.   Printer.RawMode := False;
  71.   Printer.BeginDoc;
  72.   StBarCode1.Code:=IntToStr(Random(999999)); //menghasilkan nilai random untuk barcode
  73.   StBarCode1.PaintToCanvas(Printer.Canvas,Rect(100,-200,100,200)); //print barcode dalam bentuk canvas
  74.   Printer.EndDoc;
  75. end;
  76.  
  77.  
  78. end.
  79.  
so i wonder if anyone can help with this? :(
5
What delphi version do you wish to support(pre D2009 - ansistring, post D2009 - UTF16)? What platform are you targeting with the delphi version(pre XE2 - windows only, post XE2 - OSX, IOS, etc)? I understand that the package is private, but at least can you tell us the category(graphics, networking, GUI, etc...). The answer highly depends on the above questions.
I would create a separate package for each supported versions: D7, D2007, D2009,...DXE8, Lazarus then a common directory for the sharable sources, resources, etc... and separate directories for the specific units.
6
If you just use the underline APIs then don't worry about it string will do just fine.
NOT! Which string type? Silly.... >:D >:D >:( >:( The string type can break your code very easy when it is just "string"

any string type, when used in lazarus will use the correct encoding for lazarus and when used in delphi it will use the correct encoding for delphi. There is a slight problem when strings are exchanged between lazarus and delphi but that has nothing to do with string type in the components.
{quote]
Also is possible to instantiate objects, and return a reference to it? (Having all methods, properties, etc..)
Yes that is possible, but difficult.
Quote
Oh from the dll? having the dll written in lazarus/fpc and use it from delphi or vice versa! No. You have to remember that when you pass objects between dlls and exe with out dynamic packages, you only pass a pointer on the other side and then you attach to that pointer a known vmt which is then used to translate calls to addresses, since the vmts between delphi and fpc are incompatible (the lower you inherit in the hierarcy the better your chances for compatibility) you will have a hell of a time to make this work, and even if you did manage to make it work you would have to take in to account the differences in strings and other data types as well mostly to make sure that the conversions are done properly between object and APIs.
Don't do that, indeed... DLL's have relocatable code. Shoot yourself in the foot.
well some times it is required for a pleasurable time, but yeah I agree avoid shooting your self in the foot if possible.
7
General / Re: Help conversion string UTC to Datetime
« Last post by taazz on Today at 02:20:17 pm »
do a grep in your lazarus installation directory for  iso8601 there are at least 2 functions named Iso8601ToDate in mine. 1)fpindexer, 2)lazsvnpkg.
8
General / how can i show two digit in spinedit?
« Last post by majid.ebru on Today at 02:18:04 pm »
hi

i use spin edit.

how can i show two digit in spinedit when i enter 0,1,...,9?

when i enter these numbers , spinedit just show 0,1,...,9 , how can i show 00,01,02,...,09?

please guide me

thank you
9
General / Re: Help conversion string UTC to Datetime
« Last post by critter on Today at 02:13:05 pm »
the language is Spanish
10
If you just use the underline APIs then don't worry about it string will do just fine.
NOT! Which string type? Silly.... >:D >:D >:( >:( The string type can break your code very easy when it is just "string"
{quote]
Also is possible to instantiate objects, and return a reference to it? (Having all methods, properties, etc..)
Yes that is possible, but difficult.
Quote
Oh from the dll? having the dll written in lazarus/fpc and use it from delphi or vice versa! No. You have to remember that when you pass objects between dlls and exe with out dynamic packages, you only pass a pointer on the other side and then you attach to that pointer a known vmt which is then used to translate calls to addresses, since the vmts between delphi and fpc are incompatible (the lower you inherit in the hierarcy the better your chances for compatibility) you will have a hell of a time to make this work, and even if you did manage to make it work you would have to take in to account the differences in strings and other data types as well mostly to make sure that the conversions are done properly between object and APIs.
Don't do that, indeed... DLL's have relocatable code. Shoot yourself in the foot.
Pages: [1] 2 3 ... 10

Recent

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