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 ' setAutoNavigate
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,600,400,"setAutoNavigate",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
client = 0
autoNavigate = 0
if info(3,6)<>"5" 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
   autoNavigate = msgbox("Auto-navigate on anchor clicks?",4,"setAutoNavigate") = 6
endif
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")
htmlview!.setCallback(htmlview!.ON_HYPERLINK_ENTER,"hyperlink_enter")
htmlview!.setCallback(htmlview!.ON_HYPERLINK_EXIT,"hyperlink_exit")
htmlview!.setCallback(htmlview!.ON_HYPERLINK_ACTIVATE,"hyperlink_activate")
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.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.