Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

how many copies

edited October 2003 in General
Hi,

I try to find out how many copy i have printed. I use a integer
HowManyCopies to initialise the copies.
But i can change them in the ReportPrintDialog. When i close the
ReportPrintDialog, the old value of
ppReport1.PrinterSetup.Copies is still active. Am i doing somthing wrong????


HowManyCopies := 2;
ppReport1.PrinterSetup.Copies := HowManyCopies;
ppReport1.ShowPrintDialog := True;
ppreport1.PrintReport;

procedure TForm1.ppReport1PrintDialogClose(Sender: TObject);
begin
if ppReport1.PrintDialog.ModalResult = mrCancel then
PrintenCanceld := True;
HowManyCopies := ppReport1.PrinterSetup.Copies;
end;


Thanx in advandce.

Comments

  • edited October 2003
    Hi,

    I tested your code below on my computer and it seemed to work correctly.
    Below is a link to the test app I made. Let me know what I'm doing wrong.
    I'm using ReportBuilder 7.03 with Delphi 7.

    http://www.digital-metaphors.com/tips/PrintCopiesTest.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2003
    Thx Nico,

    i used your app, but it doesn't work. I am using delphi6 and rb6.03.
    I click print, he says 2 copies, i change it into 3 copies. But the message
    after closing the printdialog says 2 copies made.
    So i think this is a bugg???? i suppose.

    Thankx



  • edited October 2003
    Hello,

    Sorry, I understand now. This is not a bug, in ReportBuilder (as well as
    most Windows applications) when a dialog is cancelled, all entered property
    values are lost.

    It is possible to replace any ReportBuilder dialogs with your own custom
    dialog. You could possibly make a custom copy of the ppPDlg.pas file with
    something like the following in the BtnCancel.OnClick event:

    FPrinter.PrinterSetup.Copies := StrToInt(edtCopies.Text);

    This way when the cancel button is clicked, the entered number in the
    edtCopies text edit will be saved down as the number of copies.

    For an example of creating and registering your own custom dialoges with
    ReportBuilder, please refer to the Developer's Guide. (\RBuilder\Developer's
    Guide\..).

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2003
    Hello Nico,

    Ok, when you cancel printing, you loose all your setting of the printdialog,
    that i can understand.
    But when you acually print, he says that i have made 2 copy instead of 3
    copies, when i change the copies in the printdialog from 2 into 3.
    He prints 3 copies, but he still says 2 copies made. Is that also normal.

    Thankx.



  • edited October 2003
    Hello,

    Try downloading the file again. I moved some code to the
    Report.OnPrintingComplete event. By the time this event fires (granted you
    selected the OK button), the Copies property will have been updated.

    http://www.digital-metaphors.com/tips/PrintCopiesTest.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2003
    Thank you very mutch, sorry for the trouble and my bad english

    Cheers.

This discussion has been closed.