Inheritance and procedure

edited February 2016 in FastReport VCL 5
Hello everyone,

First of all, english isn't my native language so please excuse me in advance.

I'm using Delphi XE, FR5 and PascalScript for the report.
I have a report called R1.fr3 with a few procedure in it, and this one:
procedure ChgFormatCurrency(Obj:TfrxComponent; AncFormat,NewFormat:String);
var i:integer;
begin
    for i:=0 to Obj.Objects.count-1 do
      ChgFormatCurrency(TfrxComponent(Obj.Objects[i]), AncFormat, NewFormat);
    
    if Obj is TfrxMemoView then
      if TfrxMemoView(Obj).DisplayFormat.formatStr = AncFormat then
        TfrxMemoView(Obj).DisplayFormat.formatStr := NewFormat;
end;

And I call it like this
ChgFormatCurrency(Report, '%2.0m', '%2.2m');

If I call this procedure from the R1.fr3 report, there is no probleme everything's working fine, all the display format of the tfrxMemoView are changed.
But, if I make a new report who inherit from the R1.fr3 one, i can call it the same way, but it's not doing anything.
Does someone have an idea on how to do this?

Thanks in advance!


(dont know how to put the topic as "solved", if an admin can do it it would be great)

Comments

  • edited 11:25PM
    I've solved my problem, even if I don't really know how.
    (Maybe it's because i've moved my procedure on top, but I really don't know =/)

  • edited 11:25PM
    stxLog wrote: »
    I've solved my problem, even if I don't really know how.
    (Maybe it's because i've moved my procedure on top, but I really don't know =/)

    As far as I know, it is not currently possible to inherit the code of the parent report as it can be done in Delphi with "inherited;". If a procedure is overriden (redeclared in the child report), FastReport will only call the code of the child report. If an event is not located in the child report, it will look in the parent report for it.

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.