API:PageWindowAddPageBreak
From RoR Wiki
UI Lua API · PageWindow functions
Version: WAR 1.4.8
Marks a window inside a PageWindow as a page break, so that it always starts a new page.
PageWindowAddPageBreak(pageWindowName, breakWindowName)
Arguments
- pageWindowName
string– Name of the PageWindow.- breakWindowName
string– Name of the window that should start a new page. It is normally a window inside the PageWindow's content.
Returns
Nothing.
Details
- The window is added to the PageWindow's list of page breaks. Nothing is laid out by this call; the list is used the next time the pages are laid out with PageWindowUpdatePages.
- During layout, a page-break window that is not already at the top of a page is moved to the top of the next page, together with everything below it.
- If
breakWindowNamedoes not exist, the call does nothing. No error is raised for it. - A window that is already in the list is not added a second time, so calling the function again for the same window is harmless.
- When PageWindowUpdatePages splits a Label across two pages, the client creates a Label named labelName
_pgbrkfor the continued text and adds it to this list itself. The stock Tome of Knowledge checks for such a window withDoesWindowExist( "BestiarySpeciesInfoText1_pgbrk" ). - The function needs at least two arguments and only reads the last two. Any extra arguments placed in front of them are ignored.
Errors
Error in function call 'PageWindowAddPageBreak': Window %s does not existError in function call 'PageWindowAddPageBreak': Window %s is not a PageWindow
Example
From default/ea_tomeofknowledge/source/tomewindow_bestiary.lua: remove a break, re-lay out the pages, and add the break back only if the text was not split:
PageWindowRemovePageBreak( "BestiarySpeciesInfoPageWindow", "BestiarySpeciesTaskAnchor" )
PageWindowUpdatePages( "BestiarySpeciesInfoPageWindow" )
if( not DoesWindowExist( "BestiarySpeciesInfoText1_pgbrk" ) )
then
WindowSetShowing( "BestiarySpeciesDivider", false )
PageWindowAddPageBreak( "BestiarySpeciesInfoPageWindow", "BestiarySpeciesTaskAnchor" )
PageWindowUpdatePages( "BestiarySpeciesInfoPageWindow" )
end
