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

Print Preview settings

edited September 2004 in Devices
D5-SP1, RB 7.04, WinXP Pro SP2

I was excited to see the new PreviewFormSettings property in v7.x.
Unfortunately it didn't provide Height and Width properties for the preview
form...so...the problem I've been having with RB 6.03 is still with me...

I have just three reports in my app. They all get called in code in roughly
the same way without a lot of prep code. I have identical
onPreviewFormCreate handlers for each report that look like this:

ppReport.PreviewForm.Height := trunc(MainForm.Height * 0.90);
ppReport.PreviewForm.Width := trunc(MainForm.Width * 0.90);

which, obviously, (attempts) to set the Preview window to 90% of the main
form's size. Of course, the name of the report is different in each event
handler.

It works exactly as expected, every time, for one, and only one, of the
reports. For another one it works fine UNTIL the same report gets called
from another point in the program (in the same way, though) in which case
the preview form size is the RB default size. Oddly, after it has been
previewed in that size, the report will no longer create the desired window
size from the other point in the program. In the case of the third report,
the event handler apparently is never fired because it will only preview in
the RB default size. I've double and triple-checked the different report
properties to insure that there is nothing significantly different between
the reports. I use only the TppReport.Print method (not PrintToDevices) in
all cases.

What would prevent the onPreviewFormCreate event from firing in some cases
and not in others? How could calling the reports from different events
result in different behaviors?

I'm really stumped. Any ideas would be greatly appreciated.

Regards,
Al

Comments

  • edited September 2004

    Thanks for the feedback concerning the PreviewFormSettings. Perhaps we
    should add the Width and Height properties.

    If you load reports from .rtm files then it is possible that the
    event-handlers are not re-attached when the report is loaded. This is a
    configuration issue. See the Templates section of the Tech Tips newsgroups
    for an article called 'Troubleshooting Lost Event Handlers'.

    I performed a simple testing by modifying the RBuilder\Demos\EndUser\Report
    Explorer application. This application uses the Report.Template.OnLoadEnd
    event to programmatically assign an event-handler to the
    Report.OnPreviewFormCreate event. In the OnPreviewFormCreate event I added
    the following code

    ppReport1.PreviewForm.WindowState := wsNormal;
    ppReport1.PreviewForm.Width := 400;
    ppReport1.PreviewForm.Height := 600;


    In my testing here, the above code works as expected.

    Try the above. If you still have an issue, please create a simple, minimal
    example project that demonstrates the behavior. Email in zip format to
    support@digital-metaphors.com and we can check it out here.





    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2004

This discussion has been closed.