Scripting in QRDesign

This sample shows how to add a BeforePrint event to a band. The code will check if the page has 20 lines, and if so, forces a new page.

The versions used - Quickreport 5.02, QRDesign 1.59

Original sample in Delphi 6. Download example

1. Please look up 'ScriptsEnabled' in the helpfile that included with this sample.

Note that in order to be able to edit scripts at runtime, the following must be set:

a. the compiler symbol "Scripts" must be enabled in QRDESIGN.INC (default)
b. ReportDesignerDialog.ScriptsEnabled must be set to TRUE (default)
c. ReportDesignerDialog.UserSettings.AllowScriptEdit must be set to TRUE (default)

'c' should be changed for later versions to
ReportDesignerDialog.UserSettings := [ AllowScriptEdit, AllowDatasetEdit];


2. In the main unit there is a reference in the Uses clause to 'qrpexpr'. This is necessary
to enable the extended functions.

3. Add the path to the QRDesign and QR5 source code to the project search path.

4. Build and run the application.

On the main form, press the button. The designer will open with the sample report. Right click on the detail band. If the context has an option 'Scripts', select that.

IF the option 'Scripts' is not on the menu, then one of the above conditions has not been met. Check that the INI file is correctly set, and if necessary, rebuild library QRD_XXX.bpl.

As a last resort, contact with the QR version, language and QR licence number clearly stated.

Make the subject line like this: QR version/Language/problem description

For example: QR5.02/Delphi2007/problem with fonts on laptop