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 a complete web browser, with full support for modern HTML5, CSS, and JavaScript.

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

Object

executeScript(string script)

BBjImage

getImage()

string

getText()

string

getUrl()

string

getUserAgent()

void

injectScript(string script)

void

injectUrl(string url)

void

injectUrl(string url, boolean top)

void

setUrl(string url)

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_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_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 ' HtmlView

sysgui = unt
open (sysgui)"X0"

sysgui!=BBjAPI().getSysGui()
window! = sysgui!.addWindow(100,100,800,750,"HtmlView",$00010003$)
htmlview! = window!.addHtmlView(101,25,25,750,650,html$)
htmlview!.setUrl("http://www.google.com")
message! = window!.addStaticText(102,25,700,550,30,"")
reload! = window!.addButton(1,685,700,90,30,"Reload")
force! = window!.addButton(2,585,700,90,30,"Force Reload")

CALLBACK(ON_CLOSE,APP_CLOSE,sysgui!.getContext())
CALLBACK(ON_HYPERLINK_ENTER,HYPERLINK_ENTER,sysgui!.getContext(),htmlview!.getID())
CALLBACK(ON_HYPERLINK_EXIT,HYPERLINK_EXIT,sysgui!.getContext(),htmlview!.getID())
CALLBACK(ON_HYPERLINK_ACTIVATE,HYPERLINK_ACTIVATE,sysgui!.getContext(),htmlview!.getID())
CALLBACK(ON_PAGE_LOADED,PAGE_LOADED,sysgui!.getContext(),htmlview!.getID())
CALLBACK(ON_BUTTON_PUSH,RELOAD,sysgui!.getContext(),reload!.getID())
CALLBACK(ON_BUTTON_PUSH,FORCE,sysgui!.getContext(),force!.getID())

PROCESS_EVENTS

HYPERLINK_ENTER:
message!.setText("Enter " + sysgui!.getLastEvent().getUrl())
return

HYPERLINK_EXIT:
message!.setText("Exit " + sysgui!.getLastEvent().getUrl())
return

HYPERLINK_ACTIVATE:
URL$ = sysgui!.getLastEvent().getUrl()
message!.setText("Activate " + URL$)
htmlview!.setUrl(URL$)
return

PAGE_LOADED:
URL$ = sysgui!.getLastEvent().getUrl()
message!.setText("Loaded " + URL$)
return

RELOAD:
URL$ = htmlview!.getUrl()
message!.setText("Activate " + URL$)
htmlview!.setUrl(URL$)
RETURN

FORCE:
URL$ = htmlview!.getUrl()
htmlview!.setUrl("http://www.basis.com")
htmlview!.setUrl(URL$)
message!.setText("Activate " + URL$)
RETURN

APP_CLOSE:
RELEASE

See Also

BBjAPI

BBjSysGui

BBjWindow

CALLBACK Verb - Register BBj Subroutine

STBL("!OPTIONS") JAVAFX_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.