BBjHtmlView::print

Description

In BBj 19.00 and higher, this method brings up a print dialogue that enables the user to print the contents of the BBjHtmlView control.

Syntax

Return Value

Method

boolean

print()

Parameters

None.

Return Value

Returns a boolean to indicate whether the print operation completed successfully.

Remarks

None.

Example

rem ' BBjHtmlView::print

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window!= sysgui!.addWindow(25,25,800,600,"BBjHtmlView::print()",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
client = 0
if (info(3,6)<>"5" and info(3,6)<>"6") then
    client = msgbox("BBjHtmlView Client",7+32+512,"BBjHtmlView","Swing","JavaFX","Chromium")
    switch client
        case 1; rem ' Swing
            print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=FALSE",ERR=*NEXT)
            print stbl("!OPTIONS","JAVAFX_HTMLVIEW=FALSE",ERR=*NEXT)
            break
        case 2; rem ' JavaFX
            print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=FALSE",ERR=*NEXT)
            print stbl("!OPTIONS","JAVAFX_HTMLVIEW=TRUE",ERR=*NEXT)
            break
        case 3; rem ' Chromium
            print stbl("!OPTIONS","CHROMIUM_HTMLVIEW=TRUE",ERR=*NEXT)
            print stbl("!OPTIONS","JAVAFX_HTMLVIEW=TRUE",ERR=*NEXT)
            break
    swend
endif

text$ = "Select content, then click the print button."

htmlview!= window!.addHtmlView(100,25,25,750,500,text$,$$)

setText! = window!.addButton(101,25,550,150,25,"setText",$$)
setText!.setCallback(setText!.ON_BUTTON_PUSH,"setText")

setUrlExternal! = window!.addButton(102,200,550,150,25,"setUrlExternal",$$)
setUrlExternal!.setCallback(setUrlExternal!.ON_BUTTON_PUSH,"setUrlExternal")

setUrlInternal! = window!.addButton(103,375,550,150,25,"setUrlInternal",$$)
setUrlInternal!.setCallback(setUrlInternal!.ON_BUTTON_PUSH,"setUrlInternal")

print! = window!.addButton(1,550,550,100,25,"print",$$)
print!.setCallback(print!.ON_BUTTON_PUSH,"print")

close! = window!.addButton(2,675,550,100,25,"Close",$$)
close!.setCallback(close!.ON_BUTTON_PUSH,"eoj")

process_events

eoj:
release

setUrlExternal:
    url$ = "https://en.wikipedia.org"
    htmlview!.setUrl(url$)
    htmlview!.setToolTipText(url$)
return

setUrlInternal:
    url$ = "http://localhost:8888/files/relnotes.htm"
    htmlview!.setUrl(url$)
    htmlview!.setToolTipText(url$)
return

setText:
    text$ = "<html><head><style>p{margin:0;padding:0;}</style><title>BASIS</title></head><body>"
    img$ = "https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png"
    img$ = "https://www.basis.cloud/images/BusJGBetter.jpg"
    text$ = text$ + "<img src="""+img$+""">"
    url$ = "https://documentation.basis.cloud/BASISHelp/WebHelp/bbjobjects/Window/bbjhtmlview/bbjhtmlview.htm"
    text$ = text$ + "<p>This is a <a href="""+url$+""">BBjHtmlView</a>."
    text$ = text$ + "</body></html>"
    htmlview!.setText(text$)
return

print:
    print! = htmlview!.print()
    System.err.println("BBjHtmlView::print "+str(print!))

    rem 'i = msgbox("BBjHtmlView::print "+str(print!))
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

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