<< Click to Display Table of Contents >> VPE_AUTOPAGEBREAK |
![]() ![]() ![]() |
Is sent, when a Auto Page Break occurred (see "Automatic Text Break" in the Programmer's Manual). The engine is on the new page. This is either a newly generated page, or an already existing page (if the text was inserted on a page, that has already pages following).
This gives you additional control over the layout. When the event is fired, VPE already moved to the next page (or generated one) and you can modify the Output Rectangle (NOT the Default Output Rectangle) to control the layout, or insert manually Headers and Footers, etc. (see "Headers and Footers" in the Programmer's Manual).
VPE_AUTOPAGEBREAK
WPARAM wParam
LPARAM lParam
Parameters:
wParam
unused
lParam
contains the document-handle, so you can determine which document has sent the message
Remarks:
Your application should return zero if it processes this message.
If your application is not able to receive events, or if you don't want to process this event for some reason, you can test for AutoBreak (this means, check if an AutoBreak occurred after inserting a text object) with the following technique:
Store the current page-number in a variable. After the output, compare this variable to the current page-number. If it is different, an AutoBreak had occurred.
Code example:
n = VpeGetCurrentPage(hDoc) // remember the current page number
VpePrint(hDoc, 1, 1, "... very long text ...")
if n <> VpeGetCurrentPage(hDoc)
catched auto break!
The formula "VpeGetCurrentPage(hDoc) - n" returns the number of
automatically generated pages.
NOTES:
If you are inserting text objects into the document while processing this event, make sure they will not cause again an Auto Page Break event - otherwise this will cause an endless recursion, ending up in a stack overflow with a GPF.
To avoid Auto Page Breaks, set AutoBreakMode = AUTO_BREAK_NO_LIMITS.
If you are modifiying any properties, as for example the AutoBreakMode or FontSize etc., it will not be reset when you code exits the event handler. If you are changing properties, you need to save and restore them by code yourself. Do this by calling VpeStoreSet() in the beginning of you event handler and by calling VpeUseSet() followed by VpeRemoveSet() at the end.
Example: if a Print() statement in your main code causes an AutoBreak and if your AutoBreak Handler sets the PenSize to something different than zero, then the rest of the text which is output by the previous Print() command of your main code will have a box around it.
Solution: at the very first beginning of your AutoBreak Handler call StoreSet() and on the last line call UseSet() and then RemoveSet(). Do this only if required, you can also check which single properties have been changed and change them back, because StoreSet() and UseSet() eat performance!
YOU MAY NOT USE NoHold of the embedded flags in the AutoBreak-Event Handler. This will cause an internal recursion and overwrite settings done in the main code. Explanation: When using the flag NoHold in your main code in a Print(Box)() or Write(Box)() statement which causes an AutoBreak, the current settings are stored in a temporary memory block (to be restored after the command has been executed). Afterwards your AutoBreak Event-Handler is executed and if you use the NoHold Flag again, the temporary memory block is overwritten, so that its initial settings are lost.