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

Remarks

You must be using Crystal 6.0 or higher to use Window Events.

Example

The following procedure illustrates the wOnCloseWindow Event:

procedure TForm1.Crpe1wOnCloseWindow(WindowHandle: Integer; var Cancel: Boolean);

begin

with Memo1.Lines do begin

Add('wOnCloseWindow Event:');

Add(' - Window is being Closed ');

Add(' - WindowHandle: ' + IntToStr(WindowHandle)); Add('');

end; end;

wOnDeActivateWindow

wOnDeActivateWindow takes place when the Preview Window becomes inactive, or loses focus. This event passes the following variables:

WindowHandle - The Handle to the current Preview Window.

Cancel - A variable that can be set to True to cancel the normal Preview Window response to the Event.

Declaration

property wOnDeActivateWindow: TCrpeGeneralPrintWindowEvent;

Type

TCrpeGeneralPrintWindowEvent = procedure(WindowHandle: HWnd; var Cancel: Boolean) of object;

Remarks

You must be using Crystal 6.0 or higher to use Window Events.

VCL Reference

180

Example

The following procedure illustrates the wOnDeActivateWindow Event:

procedure TForm1.Crpe1wOnDeActivateWindow(WindowHandle: Integer; var Cancel: Boolean);

begin

with Memo1.Lines do begin

Add('wOnDeActivateWindow Event:'); Add(' - Window was DeActivated ');

Add(' - WindowHandle: ' + IntToStr(WindowHandle)); Add('');

end; end;

wOnDrillDetail

wOnDrillDetail takes place when a Detail area on the Preview Window is double-clicked. Note that AllowDrillDown must be True on the WindowButtonBar options before the Event will be returned. This event passes the following variables:

WindowHandle - The Handle to the current Preview Window.

NSelectedField - The number of the field that was doubleclicked (if any). This number can be used to locate the field information in the FieldNames and FieldValues stringlists.

NFields - The total number of Fields in the Detail area that was drilled on.

FieldNames - A stringlist containing the Names of all the Fields in the applicable detail area.

FieldValues - A stringlist containing the actual values of the Fields in the applicable detail area. These items should correspond to the FieldNames stringlist. For example, NFields can be used to loop through the stringlists:

for cnt := 0 to (NFields - 1) do begin

ShowMessage(FieldNames[cnt]);

ShowMessage(FieldValues[cnt]);

end;

Cancel - A variable that can be set to True to cancel the normal Preview Window response to the Event.

Declaration

property wOnDrillDetail: TCrpeDrillOnDetailEvent;

VCL Reference

181

Type

TCrpeDrillOnDetailEvent = procedure(WindowHandle: HWnd; NSelectedField, NFields: smallint; FieldNames, FieldValues: TStringList; var Cancel: Boolean) of object;

Remarks

You must be using Crystal 6.0 or higher to use Window Events.

Example

The following procedure illustrates the wOnDrillDetail Event:

procedure TForm1.Crpe1wOnDrillDetail(WindowHandle: Integer; NSelectedField, NFields: Smallint; FieldNames, FieldValues: TStringList; var Cancel: Boolean); var

cnt : integer; begin

with Memo1.Lines do begin

Add('wOnDrillDetail Event:');

Add('

-

Detail

Section was drilled ');

 

Add('

-

WindowHandle: ' + IntToStr(WindowHandle));

Add('

-

Number

of Fields in Details area: ' + IntToStr(NFields));

Add('

-

Number

of Selected Field: ' + IntToStr(NSelectedField));

Add('

-

Field Names: ');

 

for cnt := 0 to

(FieldNames.Count - 1) do

Add('

 

' + IntToStr(cnt) + '. ' +

FieldNames[cnt]);

Add('

-

Field Values: ');

 

for cnt := 0 to

(FieldValues.Count - 1)

do

Add('

 

' + IntToStr(cnt) + '. ' +

FieldValues[cnt]);

Add('');

 

 

 

end; end;

wOnDrillGroup

wOnDrillGroup takes place when a Group area on the Preview Window is double-clicked or a GroupTree node is Ctrl-clicked. Note that AllowDrillDown must be True on the WindowButtonBar options before the Event will be returned. This event passes the following variables:

WindowHandle - The Handle to the current Preview Window.

NGroupLevel - The number of the Group chosen. The outer group starts with number 1, so if you use NGroupLevel to find the name of the Group in the GroupList, be sure to decrement it by 1.

VCL Reference

182

DrillType - The type of drill-down:

¾ddOnGroup - a Group area on the Report was double-clicked.

¾ddOnGroupTree - a GroupTree node was Ctrl-clicked.

¾ddOnGraph - a Graph area was double-clicked.

GroupList - A stringlist containing the names of the Groups starting from the outer group and going up to the Group chosen.

Cancel - A variable that can be set to True to cancel the normal Preview Window response to the Event.

Declaration

property wOnDrillGroup: TCrpeDrillOnGroupEvent;

Type

TCrpeDrillOnGroupEvent = procedure(WindowHandle: HWnd; NGroupLevel: Word; DrillType: TCrDrillDownType; GroupList: TStringList; var Cancel: Boolean) of object;

TCrDrillDownType = (ddOnGroup, ddOnGroupTree, ddOnGraph);

Remarks

You must be using Crystal 6.0 or higher to use Window Events.

Example

The following procedure illustrates the wOnDrillGroup Event:

procedure TForm1.Crpe1wOnDrillGroup(WindowHandle: Integer;

NGroupLevel: Word; DrillType: TCrDrillDownType; GroupList: TStringList; var Cancel: Boolean);

var

cnt: integer; begin

with Memo1.Lines do begin

Add('wOnDrillGroup Event:');

Add('

- Group Section was

drilled ');

Add('

- WindowHandle: ' +

IntToStr(WindowHandle));

case DrillType of

 

 

ddOnGroup

: Add('

-

DrillDown Type: OnGroup');

ddOnGroupTree

: Add('

-

DrillDown Type: OnGroupTree');

ddOnGraph

: Add('

-

DrillDown Type: OnGraph');

end;

 

 

 

 

VCL Reference

183

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