Back to Devexpress

TdxReportNotifyEvent Type

vcl-dxreport-ffd1c254.md

latest3.3 KB
Original Source

TdxReportNotifyEvent Type

The procedural type for general report-related notification events.

Declaration

delphi
TdxReportNotifyEvent = procedure(ASender: TdxReport) of object;

Parameters

NameTypeDescription
ASenderTdxReport

Provides access to the report generator component that raised the notification event.

|

Remarks

Handle report-related notification events to execute custom code in response to certain changes in your ExpressReports-powered application.

Code Examples

Save Report Layout to File on Every Change

The following code example saves the current report to a REPX file every time a user saves pending changes in the Report Designer dialog:

delphi
uses
  dxReport; // Declares the TdxReport class
// ...

procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
begin
  ASender.Layout.SaveToFile(ASender.ReportName + '.repx');
end;
cpp
#include "dxReport.hpp" // Declares the TdxReport class

// Add the following linker directive to the corresponding CPP source file:
#pragma link "dxReport" // Required to use dxReport.hpp declarations
// ..

void __fastcall TMyForm::dxReport1LayoutChanged(TdxReport *ASender)
{
  ASender->Layout->SaveToFile(ASender->ReportName + ".repx");
}

Save Report Layout to Database on Every Change

The following code example saves the current report to an existing BLOB dataset field every time a user saves pending changes in the Report Designer dialog:

delphi
uses
  dxReport, // Declares the TdxReport class
  dxmdaset; // Declares the TdxMemData class and related types
// ...

procedure TMyForm.dxReport1LayoutChanged(ASender: TdxReport);
begin
  dxMemData1.Edit;
  dxMemData1.FieldByName('TemplateName').AsString := ASender.ReportName;
  dxMemData1.FieldByName('TemplateLayout').Assign(ASender.Layout);
  dxMemData1.Post;
end;
cpp
#include "dxReport.hpp" // Declares the TdxReport class
#include "dxmdaset.hpp" // Declares the TdxMemData class and related types

// Add the following linker directives to the corresponding CPP source file:
#pragma link "dxReport" // Required to use dxReport.hpp declarations
#pragma link "dxmdaset" // Required to use dxmdaset.hpp declarations
// ...

void __fastcall TMyForm::dxReport1LayoutChanged(TdxReport *ASender)
{
  dxMemData1->Edit();
  dxMemData1->FieldByName("TemplateName")->AsString = ASender->ReportName;
  dxMemData1->FieldByName("TemplateLayout")->Assign(ASender->Layout);
  dxMemData1->Post();
}

Direct TdxReportNotifyEvent Type Reference

The TdxReport.OnLayoutChanged event references the TdxReportNotifyEvent procedural type.

See Also

TdxReportExportEvent Procedural Type

TdxReportPrintPreviewEvent Procedural Type

TdxDashboardControlNotifyEvent Procedural Type

dxReport Unit