Subclassing TfrxReport

edited 2:54PM in FastReport VCL 5
I tried to create the following class (see at end of this message) but when I run the report I get an error

"
Debugger Exception Notification
Project ExportToNexus.exe raised exception class EClassNotFound with message 'Class TReportGenFRXReport not found'.
Break Continue Help
"

The error is at TfrxXMLSerializer.ReadRootComponent


Here is the class

  TReportGenFRXReport = class(TfrxReport)
  strict private
    FReportID: Integer;
    FTemplateName: string;
  public
    property ReportID: Integer read FReportID write FReportID;
    property TemplateName: string read FTemplateName write FTemplateName;
    procedure Load;
    procedure Save;
  end;

The reason I am doing this is for 2 reasons but the primary reason is to pass context into the Designer Save event. The other reason is simply architecture, in that I want my special Load and Save methods and extra attributes in the report object.

Comments

  • edited 2:54PM
    I found a solution but want to make sure it is ok:

    I simply did this:
    initialization
      frxObjects.RegisterObject(TReportGenFRXReport, nil);
    
    finalization
      frxObjects.Unregister(TReportGenFRXReport);
    

    Is there any problem with passing nil, and is it a problem that I do not make some properties published?

    I am confused why it is even serializing the component, and this gives me concern that properties will get dropped.

Leave a Comment