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

Changing windowstate *After* the preview

edited September 2005 in General
Using D7, RB7.04 -

Our reports all default to maximized when the preview appears:

TppViewer(Report.PreviewForm.Viewer).ZoomSetting := zsPageWidth;
Report.PreviewForm.Height := 580;
Report.PreviewForm.Width := 780;
Report.PreviewForm.WindowState := wsMaximized;

If you try to change the window state to Normal by clicking on the button
next to the X, it always shrinks the window down to 65%. Is there a way to
set it so that it always goes to Normal at 100%?

Comments

  • edited September 2005
    Hello,

    I believe this is the normal behavior of most Windows forms. If you would
    like to customize this behavior you may need to create a custom preview
    plugin and perhaps use the OnResize event to set the zoom setting when the
    form is resized.

    -----------------------------------------
    Article: Creating a Preview Plugin
    -----------------------------------------

    Q: I've followed the tutorials and registered a Preview Form replacement but
    that did not affect the TppDesigner's Preview workspace.


    A: Do not use the form replacement, but rather, there is a different
    architecture built into the preview form that is registered by default.



    You will need to register a TppPreview descendent. The class you register
    is used to create the preview controls inside the standard print preview
    form and the designer preview workspace.


    Here is an example of creating a simple custom preview that access the
    viewer its been assigned in order to change the page color. You can also do
    more advanced operations such as adding and removing buttons and change the
    behavior of the preview form. Access the inherited controls via. protected
    properties and override the virtual methods in order to customize behavior.

    Open ppPreview.pas and view the TppPreview class as a guide to create a
    custom preview descendent.


    unit MyPreviewPlugin;

    interface

    uses
    ppPreview;

    type
    TMyPreviewPlugin = class(TppPreview)
    public
    procedure BeforePreview; override;

    end;


    implementation

    uses
    Graphics;


    procedure TMyPreviewPlugin.BeforePreview;
    begin
    inherited BeforePreview;

    Viewer.PageColor := clRed;

    end;

    initialization
    TppPreviewPlugIn.Register(TMyPreviewPlugin);

    finalization
    TppPreviewPlugIn.UnRegister(TMyPreviewPlugin);

    end.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Nico,

    Thanks for the answer. I was hoping there would be a simpler solution to
    this, but guess it'll take some work down the line.


  • edited September 2005

    Please configure your newsreader so that your name is displayed as the
    sender.




    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2005
    Sorry about that. I realized it was not configured properly after I sent
    that last email.

This discussion has been closed.