PESetEventCallback
Use PESetEventCallback to set the event callback function for the specified job. CRPE can fire certain events when something happens inside CRPE. CRPE will call the callback function and notify what kind of event has or is about to occur. Within callbackProc, the user can interpret the event ID and perform the proper process.
C Syntax
BOOL CRPE_API PESetEventCallback (
short printJob,
BOOL (CALLBACK *callbackProc)
(short eventID, void *param, void *userData)
void *userData );
Parameters
printJob
| Specifies the print job for which you want to create an Event callback procedure.
|
callbackProc
| The CALLBACK procedure that will handle your Crystal Report Engine events. This should be a pointer to a standard Windows CALLBACK procedure. Refer to the Windows SDK for information on creating CALLBACK procedures.
|
userData
| Specifies a pointer to any information you want to pass to the Event handling CALLBACK procedure. The pointer will be available in the userData member of the procedure. This value can be 0.
|
Returns
- TRUE if the call is successful.
- FALSE if the call fails.
Remarks
- Each job can have only one callback function.
- The Event procedure functions passed in the callbackProc parameter should be a standard Windows CALLBACK procedure. Refer to documentation on the Windows API for information on creating CALLBACK procedures.
- If you need to pass data to callbackProc using the userData parameter of callbackProc, be sure the memory allocated for the data does not fall out of scope or gets deallocated before the callbackProc is called by Windows. If this happens, the data will be unavailable and errors may occur in your application.
- For a complete example of how to use this function, see Handling preview window events.
- If callbackProc returns TRUE, a CRPE default action will be provided. If callbackProc returns FALSE, a CRPE default action will not be used. The user should be responsible for providing default behavior. For some events, the callbackProc return value is ignored. The following list gives the description of different events supported by CRPE.
PE_ACTIVATE_PRINT_WINDOW_EVENT
PE_CANCEL_BUTTON_CLICKED_EVENT
- Called
After clicking the cancel button; before canceling the printing or reading the database.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_CLOSE_BUTTON_CLICKED_EVENT
- Called
After clicking the close button; before closing the preview window.
- Parameter
Pointer to PECloseButtonClickedEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
- Remarks
If FALSE is returned before actually closing the preview window, a PE_CLOSE_PRINT_WINDOW_EVENT is fired.
PE_CLOSE_PRINT_WINDOW_EVENT
- Called
Before the preview window is closed.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_DEACTIVATE_PRINT_WINDOW_EVENT
PE_DRILL_ON_DETAIL_EVENT
- Called
After double-clicking one of the detail areas in the preview window.
- Parameter
Pointer to PEDrillOnDetailEventInfo.
- Return
Ignored.
PE_DRILL_ON_GROUP_EVENT
- Called
After clicking on one of the group tree nodes, double-clicking or Ctrl-clicking a node with the magnify glass cursor, or double-clicking one of the groups in the preview window; before showing the group. This event also applies to drilling on a graph.
- Parameter
Pointer to PEDrillOnGroupEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_DRILL_ON_HYPERLINK_EVENT
- Called
Whenever the user double-clicked on an object with a hyperlink (and the hyperlink is about to be executed).
- Parameter
Pointer toPEHyperlinkEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_EXPORT_BUTTON_CLICKED_EVENT
- Called
After Export button is clicked; before export process starts.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_FIRST_PAGE_BUTTON_CLICKED_EVENT
- Called
After clicking the first page button; before going to the first page.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_GROUP_TREE_BUTTON_CLICKED_EVENT
- Called
After clicking the group tree button; before showing or hiding the group tree.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
Ignored.
PE_LAST_PAGE_BUTTON_CLICKED_EVENT
- Called
After clicking the last page button; before going to the last page.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_LAUNCH_SEAGATE_ANALYSIS_EVENT
PE_LEFT_CLICK_EVENT
- Called
Whenever the left mouse button has been clicked over the preview window.
- Parameter
Pointer toPEMouseClickEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_MAPPING_FIELD_EVENT
- Called
Whenever the user calls PEVerifyDatabase and the field mapping method has been set to PE_FM_EVENT_DEFINED_FLD_MAP. The field mapping method can be retrieved and set with PEGetFieldMappingType, and PESetFieldMappingType.
- Parameter
Pointer toPEFieldMappingEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_MIDDLE_CLICK_EVENT
- Called
Whenever the middle mouse button has been clicked over the preview window.
- Parameter
Pointer toPEMouseClickEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_NEXT_PAGE_BUTTON_CLICKED_EVENT
- Called
After clicking the next page button, before going to the next page.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_PREVIOUS_PAGE_BUTTON_CLICKED_EVENT
- Called
After clicking the previous page button; before going to the previous page.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_PRINT_BUTTON_CLICKED_EVENT
- Called
After the Print button is clicked; before printing process starts.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_PRINT_SETUP_BUTTON_CLICKED_EVENT
- Called
After clicking Print Setup button; before showing the Print Setup dialog box.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_READING_RECORDS_EVENT
- Called
This event is fired during a reading database or regenerating saved data process. It is fired after a specified amount of time, not aver reading every record.
- Parameter
Pointer to PEReadingRecordsEventInfo.
- Return
Ignored.
PE_REFRESH_BUTTON_CLICKED_EVENT
- Called
After clicking the Refresh button; before refreshing the data.
- Parameter
Pointer to PEGeneralPrintWindowEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_RIGHT_CLICK_EVENT
- Called
Whenever the right mouse button has been clicked over the preview window.
- Parameter
Pointer toPEMouseClickEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_SEARCH_BUTTON_CLICKED_EVENT
- Called
After the search button is clicked; before the search starts.
- Parameter
Pointer to PESearchButtonClickedEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_SHOW_GROUP_EVENT
- Called
After clicking one of the group tree nodes; before showing that group.
- Parameter
Pointer to PEShowGroupEventInfo.
- Return
TRUE to use the default action. FALSE to cancel the default action.
PE_START_EVENT
- Called
Before the Report Engine starts a process. A process can be printing to printer, exporting, printing to a window, or generating pages when navigating through the preview window.
- Parameter
Pointer toPEStartEventInfo.
- Return
TRUE to use the default action; FALSE to cancel the default action.
PE_STOP_EVENT
- Called
Whenever a process has finished. Used in conjunction with PE_START_EVENT.
- Parameter
Pointer toPEStopEventInfo.
- Return
Ignored.
PE_ZOOM_LEVEL_CHANGING_EVENT
Delphi Syntax
function PESetEventCallback(
printJob: Word;
callbackProc: pointer
{Callback Function should be of form:
Function callbacProc(eventID: smallint;
param: pointer;
userData: pointer)}
): Bool stdcall;