Using objects in the script

Top  Previous  Next

Any report object can be accessed from a script. So, if there are for example the “Page1” page and a “Memo1” object, they can be used in the script, calling them by their names:

 

PascalScript:

 

Memo1.Color := clRed

 

C++Script:

 

Memo1.Color = clRed

 

The list of report objects accessible from the script is shown in the “Report tree” pane. What object properties are available to a script? The answer is simple: all those that are visible in the object inspector. The object inspector also shows hints for each property at the bottom. Both panes (report tree and object inspector) are available while working with a script. To get detailed help on object properties and methods use the FastReport help file which is included in the distribution kit.

 

Here's a simple example. Place a “Text” object named “MyTextObject” and containing “Test” onto the report design page. Then write this script:

 

PascalScript:

 

begin

 MyTextObject.Color := clRed

end.

 

C++Script:

 

{

 MyTextObject.Color = clRed

}

 

Run the report and see that the object’s color is red.