Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
163
Добавлен:
11.05.2015
Размер:
4.73 Mб
Скачать

The Engine property can be used whenever you build functionality into a Report that may not be available in earlier versions of the Crystal Report Engine and you need to verify the version number first. This property can also be a handy safeguard for users who have more than one version of the Crystal Report Engine with the older version earlier in the path than the new version.

NOTE: There is some internal protection built into the VCL which will prevent operation if a CRPE32.DLL earlier than 5.x.x.108 attempts to load.

The SummaryInfo object, the WindowEvents, the WindowCursor object, and most of the WindowButtonBar options (except for Visible), will only work with Crystal Reports 6.0, and the ParamFields object requires the last maintenance release of 5.0: 5.0.x.108.

Example

The following example checks to see if the version of the CRPE32.DLL is greater than 5. If it is, the WindowButtonBar buttons can be made visible/invisible.

if StrToInt(Crpe1.Version.Engine[1]) > 5 then Crpe1.WindowButtonBar.AllowDrillDown := True;

Version Major property

Declaration

property Major: integer;

Description

The Major property is a read-only property that contains the major File Version number of the CRPE32.DLL which is currently open. This is the first number sequence of the File Version string, ie. for 6, 0, 1, 135, the Major version number would be 6.

Example

The following example checks to see if the version of the CRPE32.DLL is greater than 5. If it is, the WindowButtonBar buttons can be made visible/invisible.

if Crpe1.Version.Major > 5 then Crpe1.WindowButtonBar.AllowDrillDown := True;

Version Minor property

Declaration

property Minor: integer;

VCL Reference

682

Description

The Minor property is a read-only property that contains the minor File Version number of the CRPE32.DLL which is currently open. This is the last number sequence of the File Version string, that is, for 6, 0, 1, 135, the Minor version number would be 135.

Version Windows property

Declaration

property Windows: string;

Description

This property provides a formatted string that contains the version of Windows currently being used. It is provided for general use, where certain features of an application may require different code if used on Windows95 or WindowsNT.

The string is formatted with the Windows version first, ie. "95", then a slash character: "/", then the Windows release number, that is, "4.0".

Example

The following example uses the utility function GetToken to parse the Version.Windows string:

var

str1, str2 : string; begin

str1 := Crpe1.Version.Windows; str2 := Crpe1.GetToken(str1, '/');

ShowMessage('The Windows platform is: ' + str2 + chr(10) + 'and the Windows version number is: ' + str1);

end;

Version Methods

Version Clear method

Declaration

procedure Clear;

VCL Reference

683

Description

The Clear method will reset the three Version properties to their default (empty strings). This should not normally need to be used, since the Version properties are updated every time the Crystal Reports Print Engine is opened, which is handled internally in the component.

Example

The following example shows the code syntax of the Clear method:

Crpe1.Version.Clear;

Crpe1.Version.Retrieve;

ShowMessage(Crpe1.Version.DLL);

Version CopyFrom method

Declaration

function CopyFrom(Source: TCrpeVersion): boolean;

Description

The CopyFrom method copies the Version property values from another TCrpeVersion object. It is similar to Delphi's Assign method. It is useful for transferring or temporary storage of values.

Example

The following example copies all the Version property values to a temporary TCrpeVersion object:

var

tempVersion : TCrpeVersion; begin

tempVersion := TCrpeVersion.Create; tempVersion.CopyFrom(Crpe1.Version);

{...later, when finished with the temp object...} tempVersion.Free;

end;

Version Create method

Declaration

constructor Create;

Description

The Create method is used internally in the Crystal component and does not need to be called in code.

VCL Reference

684

Version Retrieve method

Declaration

function Retrieve: boolean;

Description

The Retrieve method obtains the Version information from the Report, and stores it in the Version object. This does not normally need to be called in code, since it is called automatically whenever the Crystal Reports Print Engine is opened. The component will open the Print Engine whenever required, although it can also be opened manually via the OpenEngine method.

Example

The following example shows the code syntax of the Retrieve function:

Crpe1.Version.Retrieve;

ShowMessage(Crpe1.Version.DLL);

WindowButtonBar Properties

WindowButtonBar AllowDrillDown property

Declaration

property AllowDrillDown: boolean;

Description

AllowDrillDown determines if drill-down capability will be enabled on the Preview Window or not. This only applies to Crystal 6.0 or higher.

Example

This code example sets the WindowButtonBar properties so that Drill-Down is possible, and the Cancel button is hidden:

Crpe1.ReportName := 'MyReport.rpt'; Crpe1.Output := toWindow;

with Crpe1.WindowButtonBar do

VCL Reference

685

Соседние файлы в папке crystal