Recent

Author Topic: [Solved] Errors after Lazbarcodes update.  (Read 1077 times)

loaded

  • Hero Member
  • *****
  • Posts: 855
[Solved] Errors after Lazbarcodes update.
« on: January 21, 2023, 07:10:10 am »
Hi All,
In the applications I use, I obtain the navigation link from the geographical coordinates, then convert it to BarcodeQR and place it in the outputs.
Until now, I was doing this without any problems in version 2.0.10.
Yesterday I installed the Lazbarcodes package via OPM after upgrading to version 2.2.4. (This was the first problem to walk through the door.)
I encountered an error in my application.
// Bar code must have been rendered before drawing. //
When I overcome this with BarcodeQR1.refresh or BarcodeQR1.Update commands
I saw that the PaintOnCanvas method is not in the position of the rectangle borders I have given, but in the zero position.
Have you faced such a problem? Or how can I find a solution?


Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   BarcodeQR1.Text:='Lazarus';
  4.   BarcodeQR1.Update;  // The old application did not have this code, but now if I do not use it, the error occurs.
  5.                       // Bar code must have been rendered before drawing.
  6.   BarcodeQR1.PaintOnCanvas(self.Canvas,rect(200,200,200+BarcodeQR1.Width,200+BarcodeQR1.Height));  //the rectangle draws at the 0,0 position regardless of its boundaries.
  7. end;
  8.  
I would be grateful if you share your thoughts and suggestions.
« Last Edit: January 22, 2023, 05:14:42 am by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

loaded

  • Hero Member
  • *****
  • Posts: 855
Re: Errors after Lazbarcodes update.
« Reply #1 on: January 21, 2023, 07:58:48 am »
Unfortunately,
I reverted from version 2.0 to version 1.4 of the Lazbarcodes package and the problem is gone.

Anyway, if anyone fixes this issue in version 2.0, I would appreciate it if you let me know. Respects
« Last Edit: January 21, 2023, 08:09:45 am by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

wp

  • Hero Member
  • *****
  • Posts: 12525
Re: Errors after Lazbarcodes update.
« Reply #2 on: January 21, 2023, 11:29:32 am »
I cannot reproduce the issue. I built the attached project and it runs correctly with LazBarcodes v1.0.4 (and Laz 2.2.4) and with LazBarcodes v2.0 (and Laz/main), with and without the commented lines.

Please prepare a small project for me with which I can test the issue.

BTW, you should not paint to the form's Canvas in an OnClick event because the OS can request the form to repaint itself at any times and then your OnClick drawing is no longer available, and even some widgetsets do not allow painting outside the painting cycle.
« Last Edit: January 21, 2023, 11:46:39 am by wp »

loaded

  • Hero Member
  • *****
  • Posts: 855
Re: Errors after Lazbarcodes update.
« Reply #3 on: January 21, 2023, 07:53:24 pm »
First of all, thank you very much for taking your precious time to reply, Master wp
I tested it by adding an Image object to the example you posted. It works with this logic in the original project.
Yes, there is still a problem with the 2.0 version downloaded from OPM, I have attached the error picture. Version 1.4 works fine.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

wp

  • Hero Member
  • *****
  • Posts: 12525
Re: Errors after Lazbarcodes update.
« Reply #4 on: January 21, 2023, 11:40:12 pm »
No "master", please...

I am attaching modified versions of the two main Lazbarcodes files which should fix the issues. Now the position of the rectangle used by PaintOnCanvas is respected, not only just its size. And the "Bar code must have been rendered before drawing" error should be gone since the symbol is automatically rendered if not yet done before. This required some additional changes in the parent class of the qrcode class, but I think they are not harmful.

Please make a backup copy of the ubarcodes and udrawers files and then unzip the attachment over them. Report back so that I can upload the changes to svn.

Note that v2 of Lazbarcodes has seen massive changes, and in particular the size calculation has been modified to be more logical (at least to me). Therefore the size of the barcode symbol within the component bounds may be different between the old and new versions; I do not intend to change this...

loaded

  • Hero Member
  • *****
  • Posts: 855
Re: Errors after Lazbarcodes update.
« Reply #5 on: January 22, 2023, 05:14:26 am »
Thank you very much for your precious efforts.
Yes, as you said, the problem is fixed. It works fine on new projects. But in old projects, there is a problem when loading and compiling the project. In this case, too;
Deleting and re-adding the visual barcode component in the old project solves the problem.
Errors and working project image are attached.
Let's pay attention to the location in the running project image. If you come to that location one day, let me know and I will offer you our famous dishes and coffee. Respects.
« Last Edit: January 22, 2023, 05:23:37 am by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

wp

  • Hero Member
  • *****
  • Posts: 12525
Re: Errors after Lazbarcodes update.
« Reply #6 on: January 22, 2023, 12:14:09 pm »
But in old projects, there is a problem when loading and compiling the project. In this case, too;
Deleting and re-adding the visual barcode component in the old project solves the problem.
Ah, the StrictSize property which is not available any more... Added a call to RegisterPropertyToSkip.

The new version has been included submitted for inclusion in OPM.

Let's pay attention to the location in the running project image.
Yeah, I've been in Konya a long time ago...
« Last Edit: January 22, 2023, 12:36:31 pm by wp »

loaded

  • Hero Member
  • *****
  • Posts: 855
Re: Errors after Lazbarcodes update.
« Reply #7 on: January 22, 2023, 01:15:46 pm »
The new version has been included submitted for inclusion in OPM.
Thanks once again.

Yeah, I've been in Konya a long time ago...
I am very pleased, I hope to see you next time. Respects.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

 

TinyPortal © 2005-2018