Author Topic: [SOLVED] PrintDlg.Execute raises runtime error  (Read 4423 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 480
  • Programming is FUN only when it works :)
    • Cool Technology
[SOLVED] PrintDlg.Execute raises runtime error
« on: May 24, 2013, 02:51:06 pm »
Every time I call PrintDlg.Execute, I get run-time error. Then, my program crashes  :'( Take a look at the picture I attached to this post.

When I doubl-click on the printDlg tool on the form, it gives the error box. (Look at my attachment).

I don't understand why.

It is complaining that property "caption" is not recognized for the dialog box, but I can't alter or access the property window for the print dialog. It is based on the printer you are using. Am I correct?

« Last Edit: May 30, 2013, 05:36:56 pm by reltek »

Bart

  • Hero Member
  • *****
  • Posts: 5757
    • Bart en Mariska's Webstek
Re: PrintDlg.Execute raises runtime error
« Reply #1 on: May 24, 2013, 05:36:48 pm »
Did you add Printers4Lazarus package as requirement for the application?

Bart

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 480
  • Programming is FUN only when it works :)
    • Cool Technology
Re: PrintDlg.Execute raises runtime error
« Reply #2 on: May 24, 2013, 06:24:10 pm »
HI Bart,

Yes, I have installed Printers4Lazarus component.   8-)

Bart

  • Hero Member
  • *****
  • Posts: 5757
    • Bart en Mariska's Webstek
Re: PrintDlg.Execute raises runtime error
« Reply #3 on: May 24, 2013, 06:52:07 pm »
Yes, I have installed Printers4Lazarus component.   8-)

That does not answer my question.
Did you add it as a dependancy for the project?
Lazarus does not do that automatically for you.

Bart

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 480
  • Programming is FUN only when it works :)
    • Cool Technology
Re: PrintDlg.Execute raises runtime error
« Reply #4 on: May 24, 2013, 08:04:31 pm »
Bart  :) :D

I installed it and added to my project. The dependencies are all in the bottom of the project inspector window. I just checked and it does include Printers4Lazarus.

 8-)

Bart

  • Hero Member
  • *****
  • Posts: 5757
    • Bart en Mariska's Webstek
Re: PrintDlg.Execute raises runtime error
« Reply #5 on: May 24, 2013, 10:25:31 pm »
Possible cause: the project was conceived in an older version of Lazarus than you are currently using (or the other way around)?
Or you updated LCL but did not rebuild Lazarus, so the IDE still thinks this property exists.

If I drop a TPrintDlg on a form, it does not have a Caption property.
PrintDialog1.execute does not crash in an example app.
(Lazarus 1.1 r41211 FPC 2.6.2 i386-win32-win32)

Bart
« Last Edit: May 24, 2013, 10:31:54 pm by Bart »

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 480
  • Programming is FUN only when it works :)
    • Cool Technology
Re: PrintDlg.Execute raises runtime error
« Reply #6 on: May 24, 2013, 10:32:20 pm »
Bart,

That's an interesting observation. Initially, I installed Lazarus 1.0.8 and fpc 2.6.2. Since I had so many problem with it, I downgraded to 1.0.6. I downgraded not upgrade. So, I hadn't thought about this. I will have to look into this. Thanks Bart. It will be after holiday that I will get back to you.

 :D ;) :)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 480
  • Programming is FUN only when it works :)
    • Cool Technology
Re: PrintDlg.Execute raises runtime error
« Reply #7 on: May 29, 2013, 09:58:26 pm »
Solved it. Well, Bart. I want to thank you for giving me hints and clues. I finally figured what the problem was. Since I was in the middle of setting up my Lazarus IDE, I had went through number of components installation and uninstallation of different version of the same tool i.e. Printers4Lazarus. After removing Printer4Lazarus tool completely and rebooted the system, I reinstalled the lastest printer4lazarus tool again. After restarting my Lazarus IDE, I made sure it was pointing to the right folder (usr/bin/lib64/components/printer4lazarus). Viola!!! It works. Thanks again Bart.

 8-) :D ;) :)

 

TinyPortal © 2005-2018