PrintPage

Description

Occurs before each page of the DataWindow or DataStore is formatted for printing.

PowerBuilder event information

Event ID: pbm_dwnprintpage

Argument

Description

pagenumber

Long by value. The number of the page about to be printed.

copy

Long by value. The number of the copy being printed.


Return Values

Set the return code to affect the outcome of the event:

0 -- Do not skip the page

1 -- Skip the page

For information on setting the return code in a particular environment, see About return values for DataWindow events.

Usage

The PrintPage event for a DataWindow control recalculates DataWindow pages before each page of a DataWindow object is formatted for printing. However, you cannot use this event to modify the page number of the current page or the remaining pages in the DataWindow.

Examples

After a script prints a DataWindow control, you can limit the number of pages to be printed by suppressing every page after page 50.

This statement in a CommandButton's Clicked event script prints the contents of the DataWindow control:

dw_1.Print()

This code in the PrintPage event of dw_1 cancels printing after reaching page 50:

IF pagenumber > 50 THEN This.PrintCancel()

If you know every fifth page of the DataWindow contains the summary information you want, you can suppress the other pages with some arithmetic and a RETURN statement:

IF Mod(pagenumber / 5) = 0 THEN
      RETURN 0
ELSE
      RETURN 1
END IF

See also

Printend

PrintMarginChange

PrintStart