BBjPrintPreview::twoPage

Description

In BBj 7.0 and higher, this BBjPrintPreview method uses a two page layout.

Syntax

Return Value

Method

void

twoPage()

Parameters

None.

Return Value

None.

Remarks

None.

Example

rem ' BBjPrintPreview::twoPage

let myAPI! = BBjAPI()

rem 'Open the SysGui device
SYSGUI = UNT
OPEN (SYSGUI)"X0"

rem 'Obtain the instance of the BBjSysGui object
let mySysGui! = myAPI!.getSysGui()

rem 'Set addWindow param values
X = 10
Y = 10
WIDTH = 800
HEIGHT = 600
TITLE$="BBjPrintPreview::twoPage"

rem 'Set the current context
mySysGui!.setContext(0)

rem 'Create a window
myWindow! = mySysGui!.addWindow(X,Y,WIDTH,HEIGHT,TITLE$,$00010003$)

rem 'Add a print preview control to the window
myPreview! = myWindow!.addPrintPreview(101,50,100,700,450,"",$$)

myImageManager! = mySysGui!.getImageManager()

fitWidth! = myWindow!.addMenuButton(102,50,50,24,24,"")
width$ = "com/basis/bbj/images/fitwidth.gif"
width! = myImageManager!.loadImageFromServerJar(width$)
fitWidth!.setImage(width!)
fitWidth!.setToolTipText("Fit to width")

fitHeight! = myWindow!.addMenuButton(103,75,50,24,24,"")
height$ = "com/basis/bbj/images/fitheight.gif"
height! = myImageManager!.loadImageFromServerJar(height$)
fitHeight!.setImage(height!)
fitHeight!.setToolTipText("Fit to height")

sideBySide! = myWindow!.addMenuButton(104,100,50,24,24,"")
twopage$ = "com/basis/bbj/images/sidebyside.gif"
twopage! = myImageManager!.loadImageFromServerJar(twopage$)
sideBySide!.setImage(twopage!)
sideBySide!.setToolTipText("Fit two pages")

myMessage! = myWindow!.addStaticText(107,650,50,100,24,"Fit to height",$8000$)

form! = myAPI!.getBBjPrinter(0).getForm(0)
for page = 0 to 9
    page! = form!.createPage()
    for para = 0 to 19
        para! = page!.newParagraph()
        para!.setPosition(para,para*20)
        para!.setHorizontalFill(1)
        para$ = "Sample text for print job "+str(para)
        para!.setText(para$)
        page!.add(para!)
    next para
next page
form!.preview(myPreview!)

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
CALLBACK(ON_BUTTON_PUSH,WIDTH,mySysGui!.getContext(),fitWidth!.getID())
CALLBACK(ON_BUTTON_PUSH,HEIGHT,mySysGui!.getContext(),fitHeight!.getID())
CALLBACK(ON_BUTTON_PUSH,TWO,mySysGui!.getContext(),sideBySide!.getID())

rem 'Process Events
process_events

rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release

WIDTH:
    myPreview!.fitToWidth()
    myMessage!.setText("Fit to width")
return

HEIGHT:
    myPreview!.fitToHeight()
    myMessage!.setText("Fit to height")
return

TWO:
    myPreview!.twoPage()
    myMessage!.setText("Fit two pages")
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.