Use last printer settings, onPrint event in Delphi
Hello!
I have 2 questions regarding RB 10.02 enterprise and Delphi 2006.
We are now converting our application from D7 to Delphi 2006 and also
creating new reports. Some reports have TppImage on top and usually the
image was loaded by TppImage.OnPrint event in Delphi code. Now I am
searching how can I create this event in Delphi code in RB10.03 but I can't
find it (object browser have only properties and no events tab). Shall I
manuall write the event in the code and hope this event will be executed or
shall I use TppReport and its events? In the latter case, the same component
can load the report with Image and without it. How can I check for the
presence of the TppImage component?
The next problem, which bothers me from older RB is the printer settings.
Some of our customers have 2 printers and they usually print on one printer
(forms), sometimes to another (A4 papers). A4 papers are printed less
frequently but when they use these reports, there are some of them. Now what
I want is to know, how shall I store last printing settings (printer, bin,
copies - I guess in some global variable) and offer them to the user when
they open printer dialog for the next time? There are many TppReport
components in application and also many different reports.
And another strange feature of ReportBuilder (known from the previous
versions too). I have 2 monitors and do not use embeded forms in BDS2006.
Ocassionally I put the form/data module with TppReport component on the
second monitor (where Delphi/BDS is not on) and RB's editor opens at the
second monitor. This would be just okay if it wasn't positioned too high -
the windows' caption with buttons are not visible anymore... Can You correct
this?
With best regards,
Goran Brumen
Audax d.o.o.
I have 2 questions regarding RB 10.02 enterprise and Delphi 2006.
We are now converting our application from D7 to Delphi 2006 and also
creating new reports. Some reports have TppImage on top and usually the
image was loaded by TppImage.OnPrint event in Delphi code. Now I am
searching how can I create this event in Delphi code in RB10.03 but I can't
find it (object browser have only properties and no events tab). Shall I
manuall write the event in the code and hope this event will be executed or
shall I use TppReport and its events? In the latter case, the same component
can load the report with Image and without it. How can I check for the
presence of the TppImage component?
The next problem, which bothers me from older RB is the printer settings.
Some of our customers have 2 printers and they usually print on one printer
(forms), sometimes to another (A4 papers). A4 papers are printed less
frequently but when they use these reports, there are some of them. Now what
I want is to know, how shall I store last printing settings (printer, bin,
copies - I guess in some global variable) and offer them to the user when
they open printer dialog for the next time? There are many TppReport
components in application and also many different reports.
And another strange feature of ReportBuilder (known from the previous
versions too). I have 2 monitors and do not use embeded forms in BDS2006.
Ocassionally I put the form/data module with TppReport component on the
second monitor (where Delphi/BDS is not on) and RB's editor opens at the
second monitor. This would be just okay if it wasn't positioned too high -
the windows' caption with buttons are not visible anymore... Can You correct
this?
With best regards,
Goran Brumen
Audax d.o.o.
This discussion has been closed.
Comments
1. There should be an events tab for all the report components in the
Delphi Object Inspector. If this is not present you may have a corrupt
installation. Please try reinstalling ReportBuilder and see if it appears.
2. You could possibly save the printer setup information in a file or code
and then load it depending on the user preferences when the template is
loaded. You would need to use the Template.OnLoadEnd event to assign the
PrinterSetup properly. Then these setting will be reflected in the printer
dialog when your users print.
3. I am unclear about what is happening here. If you have a form or
datamodule on your second monitor, does the report automatically open, or
when you open the designer, the title bar is hidden?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thank You for Your answers.
AD1: I will update my RB to 10.03 soon and we'll see if then I'll have
events tab in RB designer. But what if...?
AD2: For saving and loading printer setup, where can I find an example or
two?
AD3: Report designer is not opening automaticaly. The "problem" appears when
I double click on the TppReport component and designer will open in the same
window where the datamodule/form, which has the clicked TppReport. Then the
Report designer opens and opens so, that the title bar is off the monitor's
(desktop) view point; it is moved upwards. So if I want to close this
report, then I have to resize the window a little bit, so the 2 pixels of
title bar appear and then I can move the designer wherever I like. So the
easiest thing to reproduce is, that You create a new form, put a TppReport
to another monitor and then double click the component.
Btw, I have extended desktop on GF6600 GT card, if it helps?
Best regards,
Goran
P.S: Btw, I have just remembered. Do You remember mailings about PDF and
Eastern European support? Now it seems that our accented characters with
RB10.03 and Acrobat Reader 7 (!!) it works fine, while with 5 still not.
haven't tested with 6 though.
Perhaps I'm a bit unclear about your reqirements with saving and loading the
printer setup. Do you mean to save the printer setup between executions of
your application? If so, this would entail saving the printer setup to a
file format of some sort and loading it on when the app runs. It may be
easier just to create a default TppPrinterSetup object when the app is
executed and assign it to the report.
I do not have a dual monitor setup available for testing. Are you able to
see this behavior on every dual monitor setup you have? Have you tried with
a different video card or video driver?
My guess is that Adobe decided to include more built-in fonts for the latest
version of Acrobat so some fonts that previously needed to be embedded into
the PDF file no longer have to be.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
No, I just need to store printer settings during execution of the program.
If user closes the application and start it again, then he/she will start
with defaults.
I tried this on my home and job computer, same on both. Computers are almost
identical (AMD64 3200, Win XP Pro 32bit SP2, Delphi 2006, 2 monitors, one
with GF6600GT and another with ATI x700) and both have extended desktop to
both computers. It is beautiful working with two computers Well, please
do not put all the resources in trying to correct this problem, it is a
little bit annoying but it can be solved.
Regarding the events tab. I have removed RB10.02 from Delhpi 2006 and
installed 10.03 but still I can't see any events tab in Report Builder. On
the left side I have Report tree, then properties for report (with tabs Data
and Layout), on the right is data tree, in the main window report with tabs
as usual. On the tp, below the main menu, I have tabs for Data, Calc, Design
and Preview. But no events tab for any component anywhere...?
Best regards,
Goran
Are you looking for an events tab on the object inspector included in the
designer workspace or in the Delphi object inspector? The events are
unfortunately not available in the built-in object inspector.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Many thanks for answers, I have found those events now! This is somewhat
important difference between older RB's and RB10. Sorry that I haven't been
reading more carefully Your first post, where You said I should look at
Delphi's Object inspector.
Still I am looking forward in some example for storing and retrieving
printer settings in application.
Best regards,
Goran
- one approach is to modify the Report.PrinterSetup properties prior to
calling Report.Print
Example:
myReport.SavePrinterSetup := True; // this will save printer setup mods
if {UseGlobalSettings} then
begin
myReport.PrinterSetup.PrinterName := myGlobalPrinterName;
{etc.}
end;
myReport.Print;
{optional - use myReport.PrinterSetup to initialize globals}
myGlobalPrinterName := myReport.PrinterSetup.PrinterName;
- another option is to create a custom print dialog and register it with RB,
so that is will be used rather than the default print dialog. The default
dialog is defined in ppPDlg.pas. You can descend from the class defined in
this unit or copy this unit and create a TmyPrintDialog. The registration
code appears the bottom of the unit. In your custom print dialog you could
apply the global settings.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com