We have already seen an example of a “Hello, World!” report; now let's see how to create a simple script which displays a window with the same greeting.
Open the designer and click on the “New report” button so that FastReport automatically creates a basic template. Switch to the “Code” tab and write the following script:
PascalScript:
begin
ShowMessage('Hello, World!');
end.
C++ Script:
{
ShowMessage("Hello, World!");
}
After that run the report. As expected, FastReport displays a little dialogue with a greeting:
Let's explain some details. We created a script consisting of a single “begin..end” block. So our script has a very simple structure; it consists only of a main procedure (see the “Structure of a script” section above). The main procedure is executed as soon as the report runs. In this case it displayed a greeting dialogue; the procedure ends right after the dialogue is closed. After the main procedure has finished running, the normal report construction begins.
|