rem ' BBjPrintPreview::firstPage
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::firstPage"
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,"",$$)
myPreview!.fitToWidth()
myImageManager! = mySysGui!.getImageManager()
myFirst! = myWindow!.addMenuButton(102,50,50,24,24,"",$$)
first$ = "com/basis/bbj/images/first.gif"
first! = myImageManager!.loadImageFromServerJar(first$)
myFirst!.setImage(first!)
myFirst!.setToolTipText("First page")
myPrevious! = myWindow!.addMenuButton(103,75,50,24,24,"",$$)
previous$ = "com/basis/bbj/images/prev.gif"
previous! = myImageManager!.loadImageFromServerJar(previous$)
myPrevious!.setImage(previous!)
myPrevious!.setToolTipText("Previous page")
myNext! = myWindow!.addMenuButton(104,100,50,24,24,"",$$)
next$ = "com/basis/bbj/images/next.gif"
next! = myImageManager!.loadImageFromServerJar(next$)
myNext!.setImage(next!)
myNext!.setToolTipText("Next page")
myLast! = myWindow!.addMenuButton(105,125,50,24,24,"",$$)
last$ = "com/basis/bbj/images/last.gif"
last! = myImageManager!.loadImageFromServerJar(last$)
myLast!.setImage(last!)
myLast!.setToolTipText("Last page")
myMessage! = myWindow!.addStaticText(107,700,50,50,24,"",$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!)
gosub PageNumber
rem 'Register the CALLBACK routines
CALLBACK(ON_CLOSE,APP_CLOSE,mySysGui!.getContext())
CALLBACK(ON_BUTTON_PUSH,FIRST_PAGE,mySysGui!.getContext(),myFirst!.getID())
CALLBACK(ON_BUTTON_PUSH,PREV_PAGE,mySysGui!.getContext(),myPrevious!.getID())
CALLBACK(ON_BUTTON_PUSH,NEXT_PAGE,mySysGui!.getContext(),myNext!.getID())
CALLBACK(ON_BUTTON_PUSH,LAST_PAGE,mySysGui!.getContext(),myLast!.getID())
rem 'Process Events
process_events
rem 'Callback routine called when the user closes the application window
APP_CLOSE:
release
FIRST_PAGE:
myPreview!.firstPage()
gosub PageNumber
return
PREV_PAGE:
myPreview!.previousPage()
gosub PageNumber
return
NEXT_PAGE:
myPreview!.nextPage()
gosub PageNumber
return
LAST_PAGE:
myPreview!.lastPage()
gosub PageNumber
return
PageNumber:
myMessage!.setText("Page: "+STR(myPreview!.getIndex()+1))
return
|