BBjPrintPreview::setZoom

Description

In BBj 7.0 and higher, this BBjPrintPreview method sets the zoom amount for the pages being displayed.

Syntax

Return Value

Method

void

setZoom(double zoomAmount)

Parameters

Variable

Description

zoomAmount

The zoom amount. For example, 1.0 = normal zoom 2.0 = double size, 0.5 = half size.

Return Value

None.

Remarks

None.

Example

rem ' BBjPrintPreview::setZoom

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::setZoom"

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,"",$$)

myList! = myWindow!.addListButton(102,50,50,100,200,"")
myList!.addItem("50%")
myList!.addItem("100%")
myList!.addItem("150%")
myList!.addItem("200%")
myList!.addItem("300%")
myList!.addItem("400%")
myList!.addItem("800%")
myList!.addItem("Fit Width")
myList!.addItem("Fit Height")
myList!.addItem("Fit Two Pages")
myList!.selectIndex(1)

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!)

myMessage! = myWindow!.addStaticText(103,650,50,100,24,"",$8000$)

Zoom = myPreview!.getZoom()
myMessage!.setText("Zoom: "+str(Zoom*100)+"%")

rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
CALLBACK(ON_LIST_SELECT,SCALE,mySysGui!.getContext(),myList!.getID())

rem 'Process Events
process_events

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

SCALE:
    switch myList!.getSelectedIndex()
        case 0; myPreview!.setZoom(0.5); break
        case 1; myPreview!.setZoom(1); break
        case 2; myPreview!.setZoom(1.5); break
        case 3; myPreview!.setZoom(2); break
        case 4; myPreview!.setZoom(3); break
        case 5; myPreview!.setZoom(4); break
        case 6; myPreview!.setZoom(8); break
        case 7; myPreview!.fitToWidth(); break
        case 8; myPreview!.fitToHeight(); break
        case 9; myPreview!.twoPage(); break
    swend
    Zoom = myPreview!.getZoom()
    myMessage!.setText("Zoom: "+str(Zoom*100)+"%")
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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