Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-01

How to use TPrintDialog

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

tim launchbury

Hello all

I am trying to implement printing in my app and want to use the printdialog included with lazarus. I have dropped the print dialog on the form and set it to appear when a button is clicked.

When the printdialog.execute function is executed an exception is generated. The exception is
"Project raised exception class 'EReadError' with message: Unknown property :"Caption""

This is followed by

"Project raised exception class 'EReadError' with message: Error reading pgCopies.Caption: Unknown property :"Caption""

I have tried all the suggestions I could found on the wiki and the delphi site.

my code is as follows:

unit Unit1;
{$mode objfpc}{$H+}
interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, Printers, PrintersDlgs;

type
  { TForm1 }
  TForm1 = class(TForm)
    Button1: TButton;
    PrintDialog1: TPrintDialog;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
  if printdialog1.execute then
  begin
    writeln(' ');
  end;
end;
end.

This problem occurrs with lazarus 0.9.29 revision 28950 and fpc 2.4.0 in linux with gtk2

Any suggestions or corrections would be gratefully received.

Tim

Reply by email

Maxim Ganetsky
to tim launchbury

12.01.2011 18:09, tim launchbury ?????:

Show quoted text 18 lines
Hello all I am trying to implement printing in my app and want to use the printdialog included with lazarus. I have dropped the print dialog on the form and set it to appear when a button is clicked. When the printdialog.execute function is executed an exception is generated. The exception is "Project raised exception class 'EReadError' with message: Unknown property :"Caption"" This is followed by "Project raised exception class 'EReadError' with message: Error reading pgCopies.Caption: Unknown property :"Caption"" I have tried all the suggestions I could found on the wiki and the delphi site.

Please create a bug report with complete description and small compilable test project attached.

Best regards, Maxim Ganetsky mailto:

Reply by email

tim launchbury
to Maxim Ganetsky
Please create a bug report with complete description and small compilable test project attached.

Thanks for your reply Maxim

However, I have found that the problem only occurs on my laptop. On my desktop at work ( which is supposed to be an identical installation of lazarus ), it works fine.

Regards

Tim

Reply by email