A “callback” is a 4D project method which is executed by a plug-in. PrintList Pro lets you make use of callbacks when printing a PrintList Pro object.
PrintList Pro provides five different callback methods:
Note: this limitation does not apply to computed break callbacks.
PrintList Pro makes use of a callback method to inform you when the end of a printed page is reached. This enables you to perform any necessary processing associated with the end of the page, for example, changing information printed in the footer area of that page or the header area of the next page.
Use PL_SetPageProc to specify the 4D project method PrintList Pro is to call. PrintList Pro will pass the method specified by callbackMethod two parameters: the first indicates which PrintList Pro area is calling the method, and the second specifies the last row printed on that page.
You must use the following declaration in your callback method:
C_LONGINT ($1;$2)
PL_SetBrkFunc is used to specify the callback function for use with custom calculations. The callback function functionName is called whenever PrintList Pro encounters the string “\Function” within the text that is to be printed for a specific break level.
Refer to PL_SetBrkText for details on how to embed the custom calculation string.
PrintList Pro passes information needed for the custom calculation to the callback function.
You must use the following declarations in your callback method:
C_LONGINT ($1;$2) // break level, column C_TEXT ($3) // column format C_LONGINT($4;$5) // start row, end row C_TEXT ($0) // custom calculation result to print
A break header will print information just prior to the group of related values. PL_SetBkHFunc is used to specify the name of the break header callback function. This function will be called for any break header that contains a break function.
Refer to PL_SetBrkText and PL_SetBkHText to determine how to set a break function for a break level.
The syntax of this command is identical to that of PL_SetBrkFunc.
The callback function functionName is called whenever PrintList Pro encounters the string “\Function” within the text that is to be printed for a specific break level. PrintList Pro passes information needed for the custom calculation to the callback function.
You must use the following declarations in your callback method:
C_LONGINT ($1;$2) // break level, column C_TEXT ($3) // column format C_LONGINT($4;$5) // start row, end row C_TEXT ($0) // custom calculation result to print
A 4D callback may be attached to a specific column. When information is needed for this column, PrintList Pro will execute the callback to allow you to fill the column with data.
This allows the printing of data calculated from one or more fields or arrays as well as any ad hoc data that is desired.
Parameter | Type |
---|---|
$1 | Reference of PrintList Pro object on layout |
$2 | Column number |
$3 | Type of data in this column (field type or array type) |
$4 | Pointer to temporary 4D array (field mode) or an existing sized array (array mode) |
$5 | First row for which to calculate cell |
$6 | Number of cells to calculate in column |
The first three parameters are not absolutely necessary to determine how to fill the column. They are provided to give you more flexibility in the implementation of the callback method.
The last three parameters are absolutely necessary.
You must declare all six parameters ($1 to $6) in the calculated column callback. If any of these parameters are not declared, you will get an error when compiling the database.
You must use the following declarations in your callback method:
C_LONGINT ($1;$2;$3;$5;$6)
C_POINTER ($4)
See Calculated Columns for details.
This powerful feature makes all break calculations available for subtotals or other calculated values in any break level, as well as any individual row sub-selection from the top.
These values are returned by PrintList Pro without need for actual printing.
PL_ProcessArrays is used to specify the name of the computed break callback function. This function will be called for the break levels and the columns specified by the breakArrays and dataArrays parameters.
In addition, the useDetail parameter allows calling the callback only on breaks, or for each individual row as well.
The Computed Break callback method receives three parameters: a handle needed to call PL_GetBreakValue, the current row number and the current break level, or -1 if individual rows are set to call the callback with PL_ProcessArrays.
You must use the following declarations in your callback method:
C_LONGINT ($1) // handle to pass over to PL_GetBreakValue C_LONGINT($2) // current row number C_LONGINT ($3) // break level (or -1 for an individual row)
PL_GetBreakValue is called from the callback method to perform usual break level processing calculations such as sum, minimum,etc. for the current break level (or individual row) and the specified column.
See Using Computed Breaks for details.