Custom Method no longer work in FR3.21

edited 6:38PM in FastReport 3.0
Since I upgraded from FR 3.16 to FR3.21 my custom functions no longer appear.

My functions are added uing fsGlobalUnit.AddMethod and worked properly with FR3.16.

Has anybody else had this problem?



Comments

  • edited 6:38PM
    fsGlobalUnit doesn't use.

    1) Before prepare report do this frxReport1.Parent := fsGlobalUnit;
    2)Change registration code to:
    type
      TFunctions = class(TfsRTTIModule)
      private
        function CallMethod(Instance: TObject; ClassType: TClass;
          const MethodName: String; Caller: TfsMethodHelper): Variant;
      public
        constructor Create(AScript: TfsScript); override;
      end;
    
    
    { TFunctions }
    
    constructor TFunctions.Create(AScript: TfsScript);
    begin
      inherited Create(AScript);
      with AScript do
      begin
          AddMethod('procedure ExecSQL', CallMethod);
      end;
    end;
    
    CallMethod(Instance: TObject; ClassType: TClass;const MethodName: String; var Params: Variant): Variant;
    begin
      Result := 0;
        if MethodName = 'EXECSQL' then
        // do something
    end;
    
    
    initialization
      fsRTTIModules.Add(TFunctions);
    
    end.
    
  • renerene Prague, Czech Republic, Europe
    edited 6:38PM
    Note for FR developers: Please correct the manuals too ( FR manuals). Old approach is still compilable, but no longer functionable (I tried to write my first new component and because the developer manual was obsolete I was debugging totaly insane things). Maybe better approach is to strictly remove old contructions (even if they are in some way functionable). When I want to apply some components uprgade / update I have to be prepared for some source changes (better to change three type of calls in whole project than compilable code which is not valid).
    ;)

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.