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

Re: Preview Plugin - V12.05

edited October 2013 in Devices
Hi there

Ive created a custom preview plugin, using the code from....

http://www.digital-metaphors.com:8080/Output/Preview/How_To...Add_a_Button_to_the_Preview

Ive then added some custom buttons.

I would now like to show/hide these custom buttons from my main code. Ive
tried, code like...


procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
begin
TppPrintPreview(ppReport1.PreviewForm).CUSTOMBUTTON.Visible := False;
end;

but receieve errors.

Do you have any suggestions, on how to access buttons etc in a custom
preview plugin??

Thanks

Lee

Comments

  • edited October 2013
    Hi Lee,

    Open the ppPrvDlg.pas file and take a look at the TppPrintPreview class.
    This is the preview dialog that is shown when you call Report.Print
    with the devicetype as Screen.

    In the public section you will see numerous "helper" properties giving
    access to the various toolbar buttons and features of the preview. For
    instance, the PrintButton property accesses the GetPrintButton routine
    which returns the GetPreview.PrintButton property.

    If you would like to expose some of your custom buttons and controls,
    you will need to create and register a descendent to the TppPrintPreview
    class that contains helper properties similar to these. See the
    Initialization and Finalization section of the ppPrvDlg.pas file for the
    registration procedure.

    Then your code would look something like the following...

    TppMyPrintPreview(ppReport1.PreviewForm).CUSTOMBUTTON.Visible := False;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.