Subclassing TfrxReport

edited 9:29AM 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 9:29AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.