Board index » delphi » Multiple QuickReports open, possible?

Multiple QuickReports open, possible?

Hello!

I am having a problem with QuickReports.  I want to use many QuickReports
as
MDI child windows in an application.  However, when I display my second
QuickReport window, the data in the first window is lost, and replaced with
the same data (and format) as in the second window.

I reckon this is a problem with the global QRPrinter object.  When I assign
new parameters to it, I am doing it globally.  I tried making my own local
copies of it.  I found out there is a constructor
TQRPrinter.Create(TComponent),
but I am not sure which component to use as an argument.

Does anyone know how to do this, or of any other way to accomplish the
same by using QuickReports?

With thanks,
  Markus Gudmundsson, Strengur ltd.

 

Re:Multiple QuickReports open, possible?


Quote
Marks Guemundsson wrote:

  Hello!

  I am having a problem with QuickReports.  I want to use many
  QuickReports
  as
  MDI child windows in an application.  However, when I display my
  second
  QuickReport window, the data in the first window is lost, and
  replaced with
  the same data (and format) as in the second window.

  I reckon this is a problem with the global QRPrinter object.  When I
  assign
  new parameters to it, I am doing it globally.  I tried making my own
  local
  copies of it.  I found out there is a constructor
  TQRPrinter.Create(TComponent),
  but I am not sure which component to use as an argument.

  Does anyone know how to do this, or of any other way to accomplish
  the
  same by using QuickReports?

  With thanks,
    Markus Gudmundsson, Strengur ltd.

 Blessadur Marks

Maybe i could give you a better answer if you answered these questions:

Do you create the reports (the form with the report) at startup or
dynamically when you have print them out?
Do the reports use the same data?
Are you trying to have multiple preview windows open at the same time?

I have ca 10 custom reports (complex multi table with lots of code) in
my application and 20 reports that are created on the fly (simple
reports with simple filters).  I create the reports when i need to print
and free them when i'm done. I have not had this problem with data
mixing between reports.

--
Arngrimur Sigmarsson
gri...@hugur.is

Re:Multiple QuickReports open, possible?


Arngrimur Sigmarsson <gri...@hugur.is> wrote in article
<332D5A12.4...@hugur.is>...

Quote
>> Marks Guemundsson wrote:
>>   I am having a problem with QuickReports.  I want to use many
>>   QuickReports
[some text deleted]

>>   Does anyone know how to do this, or of any other way to accomplish
>>   the
>>   same by using QuickReports?
> Maybe i could give you a better answer if you answered these questions:

> Do you create the reports (the form with the report) at startup or
> dynamically when you have print them out?

Dynamically.

Quote
> Do the reports use the same data?

No they don't.  These are also "custom QuickReports"

Quote
> Are you trying to have multiple preview windows open at the same time?

Yes.  This is an MDI application.

Quote
> I have ca 10 custom reports (complex multi table with lots of code) in
> my application and 20 reports that are created on the fly (simple
> reports with simple filters).  I create the reports when i need to print
> and free them when i'm done. I have not had this problem with data
> mixing between reports.

> --
> Arngrimur Sigmarsson
> gri...@hugur.is

If this explains the problem better, your help would be greatly
appreciated.

Markus Gudmundsson (mar...@strengur.is)

Re:Multiple QuickReports open, possible?


Quote
Marks Guemundsson wrote:

  Arngrimur Sigmarsson <gri...@hugur.is> wrote in article
  <332D5A12.4...@hugur.is>...
  >> Marks Guemundsson wrote:
  >>   I am having a problem with QuickReports.  I want to use many
  >>   QuickReports
  [some text deleted]
  >>
  >>
  >>   Does anyone know how to do this, or of any other way to
  accomplish
  >>   the
  >>   same by using QuickReports?

  > Maybe i could give you a better answer if you answered these
  questions:
  >
  > Do you create the reports (the form with the report) at startup or

  > dynamically when you have print them out?
  Dynamically.

  > Do the reports use the same data?
  No they don't.  These are also "custom QuickReports"

  > Are you trying to have multiple preview windows open at the same
  time?
  Yes.  This is an MDI application.

  > I have ca 10 custom reports (complex multi table with lots of
  code) in
  > my application and 20 reports that are created on the fly (simple
  > reports with simple filters).  I create the reports when i need to
  print
  > and free them when i'm done. I have not had this problem with data

  > mixing between reports.
  >
  > --
  > Arngrimur Sigmarsson
  > gri...@hugur.is

  If this explains the problem better, your help would be greatly
  appreciated.

  Markus Gudmundsson (mar...@strengur.is)

 I understand your problem better now.  I have tried modifying the code
that shows the preview form from ShowModal to Show.  This causes my
computer to crash badly.  I don't know what goes wrong, but showing the
preview form modally solves this.  It seems that that it isn't common
for programs to allow multiple print previews simultaneously (I checked
out a few).  My code is written in QR 1.0, I think that version 2.0 has
a separate thread for each printing job maybe that solves your
problems?
--
Arngrimur Sigmarsson
gri...@hugur.is

Re:Multiple QuickReports open, possible?


Arngrimur Sigmarsson <gri...@hugur.is> wrote in article

[text deleted]

Quote
>  I understand your problem better now.  I have tried modifying the code
> that shows the preview form from ShowModal to Show.  This causes my
> computer to crash badly.  I don't know what goes wrong, but showing the
> preview form modally solves this.  It seems that that it isn't common
> for programs to allow multiple print previews simultaneously (I checked
> out a few).  My code is written in QR 1.0, I think that version 2.0 has
> a separate thread for each printing job maybe that solves your
> problems?
> --

You have to do more than just change ShowModal to Show (at least in 1.0).
This is described in the QuickReport documentation.

I downloaded version 2.0b, tried it and this solved my problem.  Now each
preview class has an QRPrinter property so I don't use the global object
anymore.  Now I can view modeless windows with many different
Quickreports simultaneousy.

Thank you for your help.

Markus Gudmundsson, Computer Engineer, Strengur ltd., Iceland.

Other Threads