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

ReportBuilder cancel event

edited May 2017 in General
Hello.
Is there some kind of cancel event for the TppReport class?
I want to disable a button when the process of building a report was
canceled.

Thanks in advance.
Dennis

Comments

  • edited May 2017
    I found the best way to have full control over what's going on in the
    Print Preview form is to register a custom TppPreview for it:

    type
    TnxPreviewPlugin = class(TppPreview)

    protected
    procedure PrintStateChangeEvent(Sender: TObject); override;
    public
    constructor Create(aOwner: TComponent); override;
    procedure EventNotify(aCommunicator: TppCommunicator; aEventID:
    Integer; aParams: TraParamList); override;
    end;


    implementation


    constructor TnxPreviewPlugin.Create(aOwner: TComponent);
    begin
    inherited;
    end;

    { TnxPreview }

    procedure TnxPreviewPlugin.EventNotify(aCommunicator: TppCommunicator;
    aEventID: Integer; aParams: TraParamList);
    var
    lnxReportingButtons: InxReportingButtons;
    begin

    if
    TRBPrintPreview(Parent.owner).ButtonsForm.GetInterface(InxReportingButtons,
    lnxReportingButtons) then
    lnxReportingButtons.ButtonsDisabled := (Viewer.Busy) {or
    (Viewer.Report.Printing)};

    inherited EventNotify(aCommunicator, aEventID, aParams);

    end;

    procedure TnxPreviewPlugin.PrintStateChangeEvent(Sender: TObject);
    begin
    inherited;

    if not viewer.Busy then
    CancelButton.visible := False;

    end;

    initialization
    TppPreviewPlugIn.Register(TnxPreviewPlugin);

    finalization
    TppPreviewPlugIn.UnRegister(TnxPreviewPlugin);

    end.


  • edited May 2017
    Hi Dennis,

    Take a look at the TppReport.OnCancel event.

    This event fires when a user cancels the generation of a report.

    --
    Best Regards,

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