Custom objects for scripts?

edited 4:55AM in FastReport VCL 5
Using Berlin Update 2
Latest FR 5 for VCL

Currently I have custom functions that my FR3 scripts have access to from my application. frxReport1.AddFunction ...

Can I make a custom object to pass to the FR3 file?

In this case, I have an TCollection / TCollectionItem deal that I would love to pass to an existing FR3 file from my application and the script language could have access to that?

Basically trying to figure out how to pass things more complex than a string or integer to variables.


Comments

  • gpigpi
    edited 4:55AM
    Delphi:
    var BMP: TBitmap;
    begin
         BMP:=TBitmap.Create;
         BMP.LoadFromFile('Test.bmp');
         frxReport1.Script.Variables['pBMP']:=integer(BMP);
         frxReport1.ShowReport();
         BMP.Free;
    end;
    
    script:
    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    var P: TPicture;
    begin
         P:=TPicture.Create;
         P:=TPicture(pBMP);
         Picture1.Picture:=P;
    end;
    
  • edited 4:55AM
    gpi wrote: »
    Delphi:
    var BMP: TBitmap;
    begin
         BMP:=TBitmap.Create;
         BMP.LoadFromFile('Test.bmp');
         frxReport1.Script.Variables['pBMP']:=integer(BMP);
         frxReport1.ShowReport();
         BMP.Free;
    end;
    
    script:
    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    var P: TPicture;
    begin
         P:=TPicture.Create;
         P:=TPicture(pBMP);
         Picture1.Picture:=P;
    end;
    


    Where / how did TPicture get defined in the script?

    I want to pass an object I created code wise totally.. not something that would exist already in Delphi / FastReports?
  • gpigpi
    edited 4:55AM
    See fs_igraphicsrtti.pas

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.