Recent

Author Topic: Preview/Printing problem  (Read 1265 times)

Neville

  • New Member
  • *
  • Posts: 41
Preview/Printing problem
« on: March 14, 2021, 05:29:53 pm »
I have a unit/form which enables me to preview print data and optionally print it.  It works well for me, but whenever I attempt to add it into a new project, I get the following error:     Fatal: Unit PrintersDlgs searched but Printers found

I have found by trial and error that if I remove the component TPrintDialog from the unit, and then replace it, patching up the code, then everything compiles OK.  What could be causing this problem?  Should I report it as a bug?

I'm attaching the code.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Preview/Printing problem
« Reply #1 on: March 14, 2021, 05:53:59 pm »
Does your project contain a requirement for the package "Printer4Lazarus"? Open the "Project Inspector" (menu Project); the treeview should list "Printer4Lazarus" under "Required Packages". If not, then right-click on "Required Packages" > "Add" and type "Printer4Lazarus" in the edit box. > OK. Then try to compile your project again.

Unlike Delphi, the default LCL does not contain printer support. For printing you always must add the "Printer4Lazarus" package.

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Preview/Printing problem
« Reply #2 on: March 14, 2021, 07:53:42 pm »
I have a unit/form which enables me to preview print data and optionally print it.  It works well for me, but whenever I attempt to add it into a new project, I get the following error:     Fatal: Unit PrintersDlgs searched but Printers found

I have found by trial and error that if I remove the component TPrintDialog from the unit, and then replace it, patching up the code, then everything compiles OK.  What could be causing this problem?  Should I report it as a bug?

I'm attaching the code.

That is a compiler bug, I reported such behavior before but all I got was flack and a lot of theories.

As far as I know it never went anywhere..

The problem is when a file name reaches 8 letters exactly and the search happens to find a file name with the first 8 letters that match and thus stops and gives that report.


Got luck in getting it fixed...

I suppose you could some how change the file name in the first 8 so it won't match anything obvious.
The only true wisdom is knowing you know nothing

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Preview/Printing problem
« Reply #3 on: March 14, 2021, 10:37:42 pm »
That is a compiler bug, I reported such behavior before but all I got was flack and a lot of theories.
[...]
The problem is when a file name reaches 8 letters exactly and the search happens to find a file name with the first 8 letters that match and thus stops and gives that report.
I have no idea what you are talking about. Which 8 letters?

I added Neville's unit to a dummy project, and I got the reported error at first. Then I added Printer4Lazarus to the project's requirements as I explained above, and everything was fine.

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: Preview/Printing problem
« Reply #4 on: March 14, 2021, 10:54:23 pm »
yes, there is a search problem involving 8 characters in the file name matching another one.

It gives an ambiguous error if it does not find the unit its searching for but instead reports finding another unit that has the first 8 letters that match the search..
 
 I am not going to bother to dig up the thread on it, its hear somewhere in forum land..

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018