BBjHtmlView

Creation Path

BBjAPI

|

+--BBjSysGui

|

+--BBjWindow

|

+--BBjHtmlView

Description

In BBj 7.0 and higher, the BBjHtmlView control displays HTML files.

In BBj 15.0 and higher, setting the STBL("!OPTIONS") JAVAFX_HTMLVIEW option to TRUE makes the BBjHtmlView control use JavaFX (if available). In this configuration, the BBjHtmlView is an embedded WebKit browser, with support for HTML5, CSS, and JavaScript.

In BBj 19.0 and higher, setting the STBL("!OPTIONS") CHROMIUM_HTMLVIEW option to TRUE makes the BBjHtmlView control use a Chromium engine (if available). In this configuration, the BBjHtmlView is an embedded Chromium-based web browser, with support for HTML5, CSS, and JavaScript.

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

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)

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

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

Return Value

Method

int

getDragActions()

string

getDragType()

void

setDragActions(int actions)

void

setDragType(string type)

Methods of BBjHtmlView implemented for DropTarget

Return Value

Method

int

getDropActions()

void

setDropActions(int actions)

BBjVector

getDropTypes()

void

setDropTypes(BBjVector types)

Methods of BBjHtmlView implemented for Focusable

Return Value

Method

boolean

isFocusable()

void

setFocusable(boolean p_focus)

Methods of BBjHtmlView implemented for TabTraversable

Return Value

Method

boolean

isTabTraversable()

void

setTabTraversable(boolean trav)

Methods of BBjHtmlView inherited from BBjControl

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_DROP_TARGET_DROP

BBjDropTargetDropEvent

Drop Target Drop Event

D

ON_GAINED_FOCUS

BBjGainedFocusEvent

Control Focus Gained/Lost Event

f

ON_EXECUTE_SCRIPT

BBjExecuteScriptEvent

ExecuteScriptEvent

x

ON_HYPERLINK_ACTIVATE

BBjHyperlinkActivateEvent

Hyperlink Activate Event

x

ON_HYPERLINK_ENTER

BBjHyperlinkEnterEvent

Hyperlink Enter Event

x

ON_HYPERLINK_EXIT

BBjHyperlinkExitEvent

Hyperlink Exit Event

x

ON_LOST_FOCUS

BBjLostFocusEvent

Control Focus Gained/Lost Event

f

ON_MOUSE_ENTER

BBjMouseEnterEvent

Mouse Enter/Exit Event

E

ON_MOUSE_EXIT

BBjMouseExitEvent

Mouse Enter/Exit Event

E

ON_NATIVE_JAVASCRIPT

BBjNativeJavaScriptEvent

Native JavaScript Event

x

ON_PAGE_LOADED

BBjPageLoadedEvent

Page Loaded Event

x

ON_POPUP_REQUEST

BBjPopupRequestEvent

Popup Request Event

r

ON_RIGHT_MOUSE_DOWN

BBjRightMouseDownEvent

Right Mouse Button Down Event

R

CSS

The visual appearance of BUI controls is defined using CSS (cascading style sheets) rules. Easily change the default colors, border, and other settings by customizing these rules, all without changing any application code. See CSS API for a high-level overview of BUI CSS.

The BBjHtmlView control is a <div> containing a content field with a class name of .BBjHtmlView-content. If the content is set using setUrl(), it's an <iframe>. If the content is set using setText(), it is a <div> containing the specified HTML. The BBjHtmlView defines the following CSS style names:

.BBjHtmlView (the top level control)

.BBjHtmlView-content (the content, either an iframe or a div)

.BBjHtmlView.bbj-disabled (the control is disabled)

Remarks

None.

Constants inherited from BBjControl

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.