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

ShowWindow method

Declaration

procedure ShowWindow;

Description

The ShowWindow method makes a hidden Preview Window visible again. Use HideWindow to make it invisible again.

Example

The following example illustrates the ShowWindow method:

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.Output := toWindow; Crpe1.Execute;

Crpe1.HideWindow; {...after a while...} Crpe1.ShowWindow;

StrToBoolean method

Declaration

function StrToBoolean(const sValue: string): boolean;

Description

StrToBoolean is used internally in the Crystal component, but has been exposed for general purpose use. It takes a string value and returns a corresponding boolean. Using the "True" value as an example, the string value should be formatted in one of these ways:

'True', 'T', 't','Yes', 'Y', 'y', '1'

bTmp := Crpe1.StrToBoolean('Y'); {bTmp is now set to True}

VCL Reference

160

StrToDate method

Declaration

function StrToDate(const sValue: string; var dValue: TDateTime): boolean;

Description

StrToDate is used internally in the Crystal component, but has been exposed for general purpose use. It takes a Date string value and passes the equivalent DateTime value back into the dValue var parameter.

var

dValue: TDateTime; begin

if not Crpe1.StrToDate('1999,02,03', dValue) then ShowMessage('An error occured during conversion');

end;

StrToDateTime method

Declaration

function StrToDateTime(const sValue: string; var dtValue: TDateTime): boolean;

Description

StrToDateTime is used internally in the Crystal component, but has been exposed for general purpose use. It takes a DateTime string value and passes the equivalent DateTime value back into the dValue var parameter.

var

dtValue: TDateTime; begin

if not Crpe1.StrToDateTime('1999,02,03 12:22:23', dtValue) then ShowMessage('An error occured during conversion');

end;

VCL Reference

161

StrToFloating method

Declaration

function StrToFloating(const sValue: string): double;

Description

StrToFloating is used internally in the Crystal component, but has been exposed for general purpose use. It takes a Floating point string value and returns the equivalent Floating point numeric value.

var

str1 : string; dTmp : double;

begin

str1 := '1.23';

dTmp := Crpe1.StrToFloating(str1); end;

{dTmp is now: 1.23}

StrToSectionCode method

Declaration

function StrToSectionCode(const Value: string): smallint;

Description

The StrToSectionCode function is used internally in the Crystal component. It takes the Section naming convention that the component uses (for properties like SectionFormat.Section), and converts it to a Print Engine Section Code number. It is mainly included as a public function for testing purposes.

See About Section Names, Volume 1, Chapter 7, for more details

Example

The following example shows the syntax of the StrToSectionCode function:

var

nTmp: integer; begin

nTmp := Crpe1.StrToSectionCode('GH1a'); {nTmp will equal 3000}

end;.

VCL Reference

162

StrToTCrBoolean method

Declaration

function StrToTCrBoolean(const sValue: string): TCrBoolean;

Description

StrToTCrBoolean is used internally in the Crystal component, but has been exposed for general purpose use. It takes a string value ('0', '1', '2') representing a TCrBoolean value (cFalse, cTrue, cDefault) and returns the equivalent TCrBoolean type.

var

sTmp : string; crBool : TCrBoolean; begin

sTmp := '0';

str1 := Crpe1.StrToTCrBoolean(Now); {sTmp is now '-1'}

end;

This numeric string can easily be converted back into a TCrBoolean value by either using the StrToTCrBoolean function:

crBool := Crpe1.StrToTCrBoolean(sTmp); {crBool is now cFalse}

...or a line of code similar to this:

crBool := TCrBoolean(StrToInt(sTmp));

StrToTime method

Declaration

function StrToTime(const sValue: string; var tValue: TDateTime): boolean;

Description

StrToTime is used internally in the Crystal component, but has been exposed for general purpose use. It takes a Time string value and passes the equivalent DateTime value back into the "tValue" parameter.

var

sTime : string; dtTime : TDateTime;

begin

sTime := '12:01:23';

if Crpe1.StrToTime(sTime, dtTime) then ShowMessage('String converted to Time successfully!');

end;

VCL Reference

163

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