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

wOnRefreshBtnClick

wOnRefreshBtnClick takes place after the Refresh button on the Preview Window button bar is clicked, but before refreshing the data. 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 wOnRefreshBtnClick: 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.

Example

The following procedure illustrates the wOnRefreshBtnClick Event:

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

begin

with Memo1.Lines do begin

Add('wOnRefreshBtnClick Event:'); Add(' - Refresh Button clicked ');

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

end; end;

wOnRightMouseClick

wOnRightMouseClick takes place when the right Mouse button (or whichever Mouse button is mapped to the Right click in Windows) is clicked on the Preview Window. This event passes the following variables:

WindowHandle - The Handle to the current Preview Window.

MouseInfo - A structure with various items that give information about the Mouse click.

¾Action - A TCrMouseClickAction value.

¾Button - A TCrMouseClickType value.

VCL Reference

192

¾ShiftKey - True if the Shift key was held down.

¾ControlKey - True if the Control key was held down.

¾x,y - The actual mouse co-ordinates.

FieldValue - The actual value of the database field or label that was clicked on (if any).

FieldType - A TCrParamFieldType value that defines the data type of the field that was clicked on (if any).

Section - The Section name of the Report area that the Mouse was clicked in. This will be in the Crystal Reports short section-naming convention, as used throughout the VCL.

ObjectHandle - The handle of the Report object that was clicked on (if any). This number represents the order of the object in the Crystal Reports design-view page, from top to bottom, left to right.

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

Declaration

property wOnRightMouseClick : TCrpeMouseClickEvent;

Type

TCrpeMouseClickEvent = procedure(WindowHandle: HWnd; MouseInfo: TCrMouseInfo; FieldValue: string; FieldType: TCrParamFieldType; Section: string; ObjectHandle: Hwnd; var Cancel: Boolean) of object;

TCrMouseClicction = (mbNotSupported, mbDown, mbUp);

TCrMouseClickType = (mcLeft, mcRight, mcMiddle);

TCrMouseInfo

= record

Action

: TCrMouseClicction;

Button

: TCrMouseClickType;

ShiftKey

: Boolean;

ControlKey

: Boolean;

x,y

: integer;

end;

 

Remarks

The wOnRightMouseClick event is only available with Seagate Crystal Reports 7 or higher.

VCL Reference

193

Example

The following procedure illustrates the wRightMouseClick event:

procedure Crpe1wOnRightMouseClick(WindowHandle: Hwnd; MouseInfo: TCrMouseInfo; FieldValue: String; FieldType: TCrParamFieldType; Section: String; ObjectHandle: HWnd; var Cancel: Boolean);

begin

with Memo1.Lines do begin

Add('wOnRightMouseClick Event:');

case MouseInfo.Button

of

 

mcLeft

: Add('

-

Button: Left Mouse Click');

mcRight

: Add('

-

Button: Right Mouse Click');

mcMiddle : Add('

- Button: Middle Mouse Click');

end;

 

 

 

 

case MouseInfo.Action

of

 

mbNotSupported : Add('

- Action: Not Supported');

mbDown

: Add('

- Action: Mouse Button Down');

mbUp

: Add('

- Action: Mouse Button Up');

end;

if MouseInfo.ShiftKey = True then

Add('

- ShiftKey: True')

else

 

Add('

- ShiftKey: False');

if MouseInfo.ControlKey = True then

Add('

- ControlKey: True')

else

 

Add('

- ControlKey: False');

Add('

- X Coordinate: ' + IntToStr(MouseInfo.x));

Add('

- Y Coordinate: ' + IntToStr(MouseInfo.y));

Add('

- FieldValue: ' + FieldValue);

case Ord(FieldType) of

 

0

{pfNumber}

: Add('

- FieldType: pfNumber');

1

{pfCurrency}

: Add('

- FieldType: pfCurrency');

2

{pfBoolean}

: Add('

- FieldType: pfBoolean');

3

{pfDate}

: Add('

- FieldType: pfDate');

4

{pfString}

: Add('

- FieldType: pfString');

5

{pfDateTime}

: Add('

- FieldType: pfDateTime');

6

{pfTime}

: Add('

- FieldType: pfTime');

7

{pfInteger}

: Add('

- FieldType: pfInteger');

8

{pfColor}

: Add('

- FieldType: pfColor');

9

{pfChar}

: Add('

- FieldType: pfChar');

10{pfLong}

: Add('

- FieldType: pfLong');

11{pfNoValue}

: Add('

- FieldType: pfNoValue');

end;

 

 

 

VCL Reference

194

Add(' - Section: ' + Section);

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

end; end;

wOnSearchBtnClick

wOnSearchBtnClick takes place after the Search button on the Preview Window button bar is clicked, but before the search starts. This event passes the following variables:

WindowHandle

The Handle to the current Preview Window.

 

 

SearchString

The text that was entered into the Search String field on the Preview

 

Window.

 

 

Cancel

A variable that can be set to True to cancel the normal Preview Window

 

response to the Event.

 

 

Declaration

property wOnSearchBtnClick: TCrpeSearchButtonClickedEvent;

Type

TCrpeSearchButtonClickedEvent = procedure(WindowHandle: HWnd; SearchString: string; 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 wOnSearchBtnClick Event:

procedure TForm1.Crpe1wOnSearchBtnClick(WindowHandle: Integer; SearchString: string; var Cancel: Boolean);

begin

with Memo1.Lines do begin

Add('wOnSearchBtnClick Event:'); Add(' - Search Button clicked ');

Add(' - WindowHandle: ' + IntToStr(WindowHandle)); Add(' - Search String: ' + SearchString);

Add(''); end;

HQG

VCL Reference

195

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