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

TppPreviewPlugIn and TppIniStoragePlugIns

edited February 2003 in General
Hello

What should I do to save values of OutlinePanel.Width and ZoomPercentage in
the PreviewWindow ?
Also suppose, that ZoomSetting is equal to zsPageWidth , if so,
ZoomPercentage is equal to 100%.
But really we see, for example, value of 124% in the EditMask (1280x1024).
In other words, we will see differ size of the page in the PreviewWindow
after saving ZoomPercentage's value as 100 and then restoring it.

--
WBR Sergey Kovalev svk@siamed.ru
SIA International Ltd

Comments

  • edited February 2003
    Also, why this code is incorrect: event TMyPreview.AfterPreview is not
    fired.

    type
    TMyPreview = class(TppPreview)
    public
    procedure AfterPreview; override;
    procedure BeforePreview; override;
    end;

    implementation

    uses ppIniStorage;

    const
    PreviewWindow = 'PreviewWindow';
    OutlinePanelWidth = 'OutlinePanelWidth';

    //--------------------------------------------------------------------------
    ----

    procedure TMyPreview.AfterPreview;
    var
    FIniStorage: TppIniStorage;
    begin
    inherited AfterPreview;
    FIniStorage:=TppIniStoragePlugIn.CreateInstance;
    FIniStorage.WriteInteger(PreviewWindow, OutlinePanelWidth,
    AccessoryToolbar.Width);
    end;

    procedure TMyPreview.BeforePreview;
    var
    FIniStorage: TppIniStorage;
    begin
    inherited BeforePreview;
    FIniStorage:=TppIniStoragePlugIn.CreateInstance;
    AccessoryToolbar.Width:=FIniStorage.ReadInteger(PreviewWindow,
    OutlinePanelWidth,
    AccessoryToolbar.Width);
    end;
  • edited February 2003
    > Also, why this code is incorrect: event TMyPreview.AfterPreview is not
    fired

    I want to take you more details.
    TMyPreview.AfterPreview is not fired in the PreviewWindow after closing the
    window.
    AfterPreview is fired in the DesignerWindow after moving from the TabPreview
    and it is not fired after closing the DesignerWindow.

    --
    WBR Sergey Kovalev svk@siamed.ru
    SIA International Ltd
  • edited February 2003

    That is correct. If you want to fire this event when the Preview form is
    closed, then create a custom preview dialog and register it for use with RB.
    The default preview dialog is located in ppPrvDlg.pas.

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2003
    I want to know is overriding code shown below correct ?

    procedure TMyPreview.PerformPreviewAction(aPreviewAction:
    TppPreviewActionType);
    begin
    inherited PerformPreviewAction(aPreviewAction);
    if aPreviewAction = paClose then AfterPreview;
    end;

  • edited March 2003
    There are no "trigger" methods such as DoAfterPrint to override. Look at the
    ancestor preview in ppPreview.pas. You will have to check if assigned on the
    event property by name directly and call the method as it is done here:

    procedure TppCustomPreview.Print;
    begin

    if FReport = nil then Exit;

    if (Assigned(BeforePrint)) then BeforePrint(Self);

    try
    FViewer.Print;
    finally
    if (Assigned(AfterPrint)) then AfterPrint(Self);
    end;


    --
    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.