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

Preview Icon

edited July 2002 in General
Can anyone help me with this?

I drop a TppReport onto a form and set its icon property to, say, one of
those provided with Delphi.
When the program runs and I choose to preview the report, the built-in
preview form still has the yellow 'R' icon.
I've tried a variety of icons and none works.
I'm trying to get the preview to match the 'house style' of the rest of the
app.

What am I doing wrong?

-Pete

Comments

  • edited July 2002
    Use the OnPreviewFormCreate event to assign the form a custom icon. For
    example:

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
    begin

    TppReport(Sender).PreviewForm.Icon.LoadFromFile('C:\FH40\gallery\globe1.ico'
    );
    end;

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    Many thanks!

    But why doesn't it work as expected using the published property?


    -Pete


    "Alexander Kramnik (Digital Metaphors)" wrote
  • edited July 2002
    That does work though I have been able to reproduce the problem a few times
    in D6. Which version of Delphi and RB are you using? I'll look into why this
    could be hapenning.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    I have Delphi 6 Enterprise and RB 6.03 Enterprise.

    Here's another 'funny'.
    I have a very simple test app which loads one of two reports. The reports
    take the form of binary templates.
    I have a couple of lines in the TppReport's OnPreviewFormCreate event to do
    with setting up the size and zoom of the previewer (the default previewer).
    Within this test app I have something like this:
    ...
    if FurnaceType = 0 then
    SummaryRpt.Template.FileName := 'Foo.rtm'
    else
    SummaryRpt.Template.FileName := 'Bar.rtm';
    SummaryRpt.Template.LoadFromFile;
    ...

    ..depending on what the user selects.

    Here's the anomaly: if he selects 'Foo' the OnPreviewFormCreate never fires.
    If he selects 'Bar', it does!

    -Pete





    "Alexander Kramnik (Digital Metaphors)" wrote
  • edited July 2002
    Hi Peter,

    you have to re-assign the event after you loaded the report. No anomaly, the
    one report was saved having the event assigned, the other one not.

    HTH,
    Chris Ueberall;

  • edited July 2002
    I see...
    Thanks, Chris.
    I should have been aware of that: I've fallen foul of the template business
    before - and I still can't get it through my thick head that loading a
    template can (and does) wipe out a load of design time settings.

    -Pete


This discussion has been closed.