BBjHtmlView::setAutoNavigate

Description

In BBj 19.0 and higher, this method tells the BBjHtmlView control whether it should automatically navigate to anchor links that the user clicks on.

Syntax

Return Value

Method

void

setAutoNavigate(boolean AutoNavigate)

Parameters

Variable

Description

void

This boolean value specifies whether the control should automatically navigate to anchor links when the user clicks on them.

Return Value

None.

Remarks

By default, this value is false; the browser will not automatically navigate to clicked anchor links.

Example

rem ' BBjHtmlView::setAutoNavigate

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,600,400,"BBjHtmlView::setAutoNavigate",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
client = 0
autoNavigate = 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
autoNavigate = msgbox("Auto-navigate on anchor clicks?",4+256,"setAutoNavigate") = 6
hyperlinkEvents = msgbox("Register for hyperlink events?",4,"Hyperlink Events") = 6
html$="<html><a href='anchor1'>anchor1</a><br><a href='anchor2' onclick='return false;'>anchor2 (cancel)</a><br><a href='https://en.wikipedia.org'>en.wikipedia.org</a></html>"
htmlview! = window!.addHtmlView(101,25,25,550,350,html$)
htmlview!.setAutoNavigate(autoNavigate)
htmlview!.setCallback(htmlview!.ON_PAGE_LOADED,"page_loaded")
if (hyperlinkEvents) then
    htmlview!.setCallback(htmlview!.ON_HYPERLINK_ENTER,"hyperlink_enter")
    htmlview!.setCallback(htmlview!.ON_HYPERLINK_EXIT,"hyperlink_exit")
    htmlview!.setCallback(htmlview!.ON_HYPERLINK_ACTIVATE,"hyperlink_activate")
endif
print htmlview!.getClientType()," ",htmlview!.getClientVersion()
print "getAutoNavigate: ",Boolean.valueOf(htmlview!.getAutoNavigate())
process_events

eoj:
release

page_loaded:
    event! = sysgui!.getLastEvent()
    print event!.getEventName()," ",event!.getUrl()
return

hyperlink_enter:
    event! = sysgui!.getLastEvent()
    print event!.getEventName()," ",event!.getUrl()
return

hyperlink_exit:
    event! = sysgui!.getLastEvent()
    print event!.getEventName()," ",event!.getUrl()
return

hyperlink_activate:
    event! = sysgui!.getLastEvent()
    name$ = event!.getEventName()
    url$ = event!.getUrl()
    print name$," ",url$
    void = msgbox(url$,0,name$)
return

See Also

BBjAPI

BBjSysGui

BBjControl

BBjWindow

BBjHtmlView

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