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

C++ Builder 3

The following topics are discussed in this section.

Introduction, Page 224

Code Syntax, Page 224

Additional Code Examples, Page 225

Introduction

The Inprise (formerly Borland) C++ Builder 3 version of Seagate Crystal Reports 32-bit Delphi VCL Component has the same features as the Delphi version. In fact, it was recompiled from the Delphi source code. This component is released "as-is". It has slight modifications to the source (nothing that affects the properties or methods, just some compiler directives, etc.) made by a third party, to make it compile and run in the BCB3 environment. Currently, only limited support is offered for any problems arising from the use of this component. The Help file included is from the Delphi VCL Component, using Delphi code examples. Some notes regarding the BCB syntax are included below.

Note that it is always possible to use direct Print Engine calls to the CRPE32.DLL using the CRPE.H and other header files included with Crystal Reports as an alternative.

The installation of the C++ Builder Component was discussed earlier in this chapter in the installation section,

C++ Builder 3, Page 198.

Code Syntax

The general guidelines for translating the Delphi code examples (in the Help file) to BCB are as follows:

1.Use the equals sign (=) instead of the colon-equals sign (:=) for assignment, and use the arrow pointer (->) instead of Delphi's dot (.) to specify class members.

//Delphi Crpe1.DetailCopies := 3; //C++Builder Crpe1->DetailCopies = 3;

2.Use double quotes ("test") instead of single quotes ('test') for strings, and use double slashes for directories (\\) instead of single slashes (\).

//Delphi

Crpe1.ReportName := 'C:\Report1.rpt'; //C++Builder

Crpe1->ReportName = "C:\\Report1.rpt";

Seagate Crystal Visual Component Library

224

3.Use the open brackets to specify a method or function that takes no parameters:

//Delphi

Crpe1.SectionFormat.Retrieve;

//C++Builder Crpe1->SectionFormat->Retrieve();

4.For default array properties, use the name of the array property instead of just the array brackets:

//Delphi

Crpe1.SectionFormat[1].BackgroundColor := clRed; //C++Builder Crpe1->SectionFormat->Item[1]->BackgroundColor = clRed;

Additional Code Examples

Here are a few more brief examples that show the proper syntax for using the VCL Component. Refer to the Help file for a reference as to what the actual Component properties do.

//Set Report Name

Crpe1->ReportName = "d:\\7Company.rpt";

//Retrieve Server Information and set Password

Crpe1->Connect->Retrieve();

Crpe1->Connect->Password = "password";

//Test the Connection

if (Crpe1->Connect->Test()) ShowMessage("Test Succeeded");

else

ShowMessage("Test Failed"); //Retrieve and set Parameter Fields

Crpe1->ParamFields->Retrieve();

//According to which parameter field you want, you can set the //ItemIndex (first parameter starts at 0) and have the ability //to directly change the Value in this field

Crpe1->ParamFields->ItemIndex = 0;

Crpe1->ParamFields->Value = "CA";

//Retrieve SectionFormat and set BackgroundColor to Red for the Details section

Seagate Crystal Visual Component Library

225

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