BBjHtmlView

Description

The BBjHtmlView control displays HTML files, and can act as a complete embedded web browser, with support for HTML5, CSS, and JavaScript.

The BBjHtmlView can be configured through STBL options to be either an embedded WebKit browser using JavaFX, or an embedded Chromium-based browser. See STBL Options for BBjHtmlView below.

Access to the JAVAFX_HTMLVIEW and CHROMIUM_HTMLVIEW features requires an active Software Asset Management (SAM) subscription. See Benefits of ‘Software Asset Management' Feature Line.

Implemented Interfaces

DragSource, DropTarget, Focusable, TabTraversable

Creation

BBjAPI > BBjSysGui > BBjWindow > BBjHtmlView

A BBjHtmlView object is created through the following BBjWindow methods:

Return Value

Method

BBjHtmlView

addHtmlView(int ID, int x, int y, int width, int height, string html)

BBjHtmlView

addHtmlView(int ID, int x, int y, int width, int height, string html, string flags)

BBjHtmlView

addHtmlView(int ID, int x, int y, int width, int height, string html, string flags, string chromium_switches$)

Methods of BBjHtmlView

Return Value

Method

void

executeAsyncScript(string script)

Object

executeScript(string script)

boolean

getAutoNavigate()

string

getClientType()

string

getClientVersion()

BBjImage

getImage()

string

getText()

string

getUrl()

string

getUserAgent()

void

injectScript(string script)

void

injectScript(string script, boolean top)

void

injectUrl(string url)

void

injectUrl(string url, boolean top)

boolean

print()

void

setAutoNavigate(boolean autoNavigate)

void

setUrl(string url)

void

setUrl(string url, boolean reload)

void

setUserAgent(string userAgent)

Methods of BBjHtmlView implemented for DragSource

Methods of BBjHtmlView implemented for DropTarget

Methods of BBjHtmlView implemented for Focusable

Methods of BBjHtmlView implemented for TabTraversable

Methods of BBjHtmlView inherited from BBjControl

Constants inherited from BBjControl

Events

BUI CSS

STBL Options for BBjHtmlView

Version History

Example

rem ' BBjHtmlView
url$ = "http://www.useragentstring.com/"
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
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
endif
window! = sysgui!.addWindow(25,25,600,500,url$,$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
htmlview! = window!.addHtmlView(102,25,25,550,450,"",$$)
htmlview!.setUrl(url$)
clientType$ = htmlview!.getClientType()
clientVersion$ = htmlview!.getClientVersion()
title$ = window!.getTitle() + " " + clientType$ + " " + clientVersion$
window!.setTitle(title$)
process_events
eoj:
release
resize:
  gosub event
  width = event!.getWidth() - 50
  height = event!.getHeight() - 50
  htmlview!.setSize(width,height)
  print width,height
return
event:
  event! = sysgui!.getLastEvent()
  print event!.getEventName()," ",event!.getControl()
return

See Also

BBjAPI

BBjSysGui

BBjWindow

CALLBACK Verb - Register BBj Subroutine

STBL("!OPTIONS") JAVAFX_HTMLVIEW

STBL("!OPTIONS") CHROMIUM_HTMLVIEW

Focusable

TabTraversable

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.