Multiple bugs in Laz Reports with Proposed Fixes
Original Reporter info from Mantis: TWhyman
-
Reporter name: Tony Whyman
Original Reporter info from Mantis: TWhyman
- Reporter name: Tony Whyman
Description:
Laz Reports is a very valuable part of Lazarus. However, it does seem rather buggy and the Barcode component seems all but unusable for anything but basic work. As I needed a working Laz Reports, I have put the effort into fixing these bugs. The bug list follows and the proposed fixes to lr_class.pas and lr_barc,pas follow as a zipped attachment,
LazReports Classes Issues List (l2class.pas)
==============================
- Ragged Right Printing
While right justified text appears correct in preview mode, it is printed with a ragged right alignment (Gtk2, X86_64 Linux).
Problem seems to be in TfrMemoView.ShowMemo. Textwidth is calculated from the variable "nw" - I can't see where this comes from. However, replacing nw, with a more obvious "Canvas.TextWidth(St)" fixes the problem.
- Vertical Text does not Work.
The code for this is commented out and looks half finished. I have completed the work and the result now seems to work correctly on both Linux and Windows.
LazReports Barcode Unit Issues List (lr_barc.pas)
===================================
- Both IDE and Runtime report a problem when a LR Report is streamed in and when a report with a barcode is included in LFM. This is because the component does not register itself with Lazreports until the dummy component is streamed in. The result is that when the frReport object is streamed before the Barcode extension is registered, then an error is reported.
Proposed Fix: Move component registration to initialization section.
- Cannot use a database field as the barcode source (or a variable) - edit box always refuses to close and generates and invalid data error.
Problem is in TfrBarCodeForm.bOkClick. This attempts to regenerate the barcode using the current text value, but does not check to see if it is a database field source. As a result, this always fails and the editor will not accept the database field.
Proposed fix: check for a '[' and use default value if found.
- Barcode checksum error causes IDE to crash.
TfrBarCodeView.GenerateBitmap does not trap an exception generated by the Barcode rendered resulting in an IDE crash when and if one is generated.
Proposed Fix: Trap exception and replace barcode text with error message.
- Default Text does not include checksum - error generated when default text is used and checksum property not set.
Proposed Fix: Force Barcode Generator checksum property to true when setting default text.
- Rendered text does not include checksum when checksum is generated by barcode renderer.
Proposed Fix: extend Barcode renderer to return checksumed code and use when rendering text.( not implemented in attachment)
- Cannot set a non-integer zoom factor in editor, even though this is a floating point value.
TfrBarCodeForm.edZoomKeyPress only allows the use of 0..9.
Proposed fix: extend the set of allowed characters to include '.'
- Zoom ratio not passed through to barcode renderer - code commented out.
Proposed Fix: none as yet.
- Zoom coerced to integer when displayed in edit box.
Proposed fix: change formatting string to %.1f
-
Barcode lost on rotation due to incorrect calculation of barcode origin.
-
Barcode text not rotated due to TFont orientation not set.
-
Incorrect barcode text placement for rotations 180 and 270.
-
Barcode text is fuzzy when printed. This is because it is written to a low resolution bitmap and then stretched to print on the printer canvas.
Proposed Fix: Write text direct to printer canvas.
Uploaded unit has been significantly changed from original in order to resolved issues 9 to 12.