BBjPrintPreview::scrollDown

Description

In BBj 7.0 and higher, this BBjPrintPreview method scrolls the print preview area down.

Syntax

Return Value

Method

void

scrollDown()

Parameters

None.

Return Value

None.

Remarks

None.

Example

rem ' BBjPrintPreview::scrollDown

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

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

myDown! = myWindow!.addMenuButton(106,150,50,24,24,"",$$)
pagedown$ = "com/basis/bbj/images/pagedown.gif"
pagedown! = myImageManager!.loadImageFromServerJar(pagedown$)
myDown!.setImage(pagedown!)
myDown!.setToolTipText("Scroll down")

myUp! = myWindow!.addMenuButton(107,175,50,24,24,"",$$)
pageup$ = "com/basis/bbj/images/pageup.gif"
pageup! = myImageManager!.loadImageFromServerJar(pageup$)
myUp!.setImage(pageup!)
myUp!.setToolTipText("Scroll up")

myMessage! = myWindow!.addStaticText(108,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())
CALLBACK(ON_BUTTON_PUSH,SCROLL_DOWN,mySysGui!.getContext(),myDown!.getID())
CALLBACK(ON_BUTTON_PUSH,SCROLL_UP,mySysGui!.getContext(),myUp!.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

SCROLL_DOWN:
    myPreview!.scrollDown()
    gosub PageNumber
return

SCROLL_UP:
    myPreview!.scrollUp()
    gosub PageNumber
return

PageNumber:
    myMessage!.setText("Page: "+STR(myPreview!.getIndex()+1))
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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