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

Disable Thumbnail Viewer when the report preview is loaded

edited November 2014 in General
Hi,

is it possible to disable the Thumbnail Viewer (the thumbnails on the
left side of the preview window) when the report preview is loaded, for
all the existing (and future) reports? The effect should be as if
manually setting report.ThumbnailSettings.Enabled := False;


Thanks and regards,
Jure

Comments

  • edited November 2014
    Hi Jure,

    I'm not sure I understand the issue. You can set the
    ThumbnailSettings.Enabled to False before calling Report.Print to
    disable the thumbnails for every report you preview.

    Do you mean to change the default value of this property when a report
    is created?

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2014
    Hi Nico,


    Sorry for the unclear question, I'll try to explain better.

    What I want to achieve, is to disable the thumbnail viewer in every
    preview window. The problem is that our application has many reports in
    many different forms in Delphi, so to achieve that, I should change the
    ThumbnailSettings.Enabled property of every report in the application
    (probably I could write a script to parse the .dfm files and change/add
    the property, but that still means changing all the reports in the
    application).

    What I'm trying to figure out is if there's any way to centrally
    handle/disable the thumbnail preview for all the TppReport components in
    the application? Something similar to the kind of functionality you
    suggested in the post from 20.2.2013 titled "Problem displaying the
    Print Preview form when adding a button to the Print Preview toolbar".
    Part of my question (and your answer) in that post was how to set up a
    drop down menu in the report preview window for all the reports (so the
    code change was only in one unit, all the existing reports weren't
    changed). Part of the solution was to override the
    TppPreview.CreateToolbarItems procedure. I was hoping the
    "Viewer.Report" (TppProducer class) had the ThumbnailSettings property
    so that I could change this property in the same unit which "centrally"
    handles the drop-down menus, but unfortunately it doesn't.

    Thank you and regards,
    Jure

  • edited November 2014
    Hi Jure,

    Thanks for the clarification. You have two options in this case.

    1. Create a custom preview plugin and overrides the default value of the
    OutlineSettings and ThumbnailSettings. See the ConfigureOutline routine.

    http://www.digital-metaphors.com/rbWiki/Plugins/Dialogs/Preview_Plugin

    2. Create a driver unit for all your form based reports similar to the
    main reports demo we include with ReportBuilder (\Demos\1. Reports\...).
    This way all reports are loaded from a single routine and can be
    initialized how you need.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2014
    Hi Nico,

    thanks for the answer.

    I'd prefer to go with the first option you suggested since I already
    have a unit for a custom preview plugin (for rendering a drop-down menu).

    I checked the implementation of the private procedure
    TppPreview.ConfigureOutline in ppPreview.pas, however I don't know how
    to override the default value of the OutlineSettings and
    ThumbnailSettings (the method isn't virtual). Do you mean I should call
    the TraRTTI.SetPropValue method in the custom preview plugin unit to set
    the default value of the properties 'OutlineSettings' and
    'ThumbnailSettings' to false? If so, where should be it called? If you
    have a similar example of how to achieve that I'd be very grateful.

    Thank you and regards,
    Jure
  • edited November 2014
    Hi Jure,

    The ConfigureOutline routine is simply to give you a reference on how
    you might hide the Thumbnails in code.

    The ConfigureOutline routine is called from the BeforePreview method
    which is virtual. Overriding BeforePreview and hiding the thumbnails
    after you call inherited should give you the effect you are after.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2014
    Hi Nico,

    thanks for the update.

    I'm making some progress - I've managed to hide the thumbnails, but the
    vertical empty panel on the left is still visible (by "empty panel" I
    mean the vertical rectangle on the left side which is used as the
    background for the stack of thumbnails and which is separated from the
    main report with a vertical bar). Could you please advise me on how hide
    also that panel? The code I used so far is as follows:

    TmyPreview = class(TppPreview)
    private
    FComboBox: TppDesignComboBoxToolItem;
    FOutlineNotebook: TppOutlineNotebook;
    FSplitter: TSplitter;
    FAccessoryToolbar: TPanel;
    protected
    procedure CreateToolbarItems; override;
    procedure ehStyle_Change(Sender: TObject);
    public
    property ComboBox: TppDesignComboBoxToolItem read FComboBox;
    procedure BeforePreview; override;
    end;
    .

    .
    procedure TmyPreview.BeforePreview;
    begin
    inherited;
    FOutlineNotebook := CreateOutlineNotebook;

    FOutlineNotebook.ThumbnailsVisibility(false);
    FOutlineNotebook.OutlineVisibility(false);
    FOutlineNotebook.OutlineEnabled := false;
    FOutlineNotebook.ThumbnailsEnabled := false;
    FOutlineNotebook.Visible := false;

    // call reset after setting OutlineVisible above
    OutlineViewer.Reset;

    //calls taken from ConfigureAccessoryPanelVisibility;
    FSplitter := TSplitter.Create(Parent);
    FSplitter.Parent := Parent;
    FSplitter.Visible := false;

    FAccessoryToolbar := TPanel.Create(Parent);
    FAccessoryToolbar.Parent := Parent;
    FAccessoryToolbar.Visible := false;
    end;

    The FAccessoryToolbar actually isn't the empty panel on the left since
    if I set its width to eg. 250 it gets rendered in a different color
    (clBtnFace) than the already present empty panel. Additionally it gets
    drawn next to the empty panel.

    So if you have any suggestion on how to hide the empty panel, I'd be
    very grateful.

    Thank you in advance and regards,
    Jure
  • edited November 2014
    Hi Jure,

    By the time your code is executed, the OutlineNotebook and
    AccessoryToolbar are already created. There is no need to recreate
    these objects. Your code should be fairly simple..

    procedure TmyPreview.BeforePreview;
    begin
    inherited;

    AccessoryToolbar.Visible := false; //Never show the accessory
    toolbar (outline and thumbnails)
    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2014
    Thank you very much Nico, that did the job.

    Regards,
    Jure
This discussion has been closed.