BBjHtmlEdit


Creation Path


BBjAPI

|

+--BBjSysGui

|

+--BBjWindow

|

+--BBjHtmlEdit

 

Description

In BBj 16.0 and higher, the BBjHtmlEdit control implements a rich text editor backed by HTML.

Implemented Interfaces

Focusable, TabTraversable

Creation

A BBjHtmlEdit object is created through the following BBjWindow methods:

 

Return Value

Method

BBjHtmlEdit

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

BBjHtmlEdit

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

Methods of BBjHtmlEdit

Return Value

Method

BBjVector

getAllToolbarStyles()

boolean

getBasicToolbar()

BBjVector

getBasicToolbarStyles()

string

getPlainText()

string

getText()

void

setBasicToolbarStyles(BBjVector styles)

void

setPlainText(string text)

void

setText(string text)

void

setBasicToolbar(boolean basicToolbar)

Methods of BBjHtmlEdit implemented for Focusable

Return Value

Method

boolean

isFocusable()

void

setFocusable(boolean p_focus)

Methods of BBjHtmlEdit implemented for TabTraversable

Return Value

Method

boolean

isTabTraversable()

void

setTabTraversable(boolean trav)

Methods of BBjHtmlEdit inherited from BBjControl

Events

Callback Code

Object-oriented Event

Read Record Event

Code

ON_EDIT_MODIFY

BBjEditModifyEvent

Edit Control Modify Event

e

ON_GAINED_FOCUS

BBjGainedFocusEvent

Control Focus Gained/Lost Event

f

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 BBjHtmlEdit control is a <div> containing an editor component consisting of a toolbar and an editing area. The BBjHtmlEdit defines the following CSS style names:

.BBjHtmlEdit (the top level control)

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

Most of the styling happens internally within the editor component; these CSS selectors can only apply minimal additional styling, and some rules may require the use of !important to override internal editor rules.

Remarks

None.

Constants inherited from BBjControl

Example

rem ' BBjHtmlEdit
basic = 0
basic = msgbox("Basic toolbar?",4+32+256) = 6
minimized = 0
minimized = msgbox("Initially minimized toolbar?",4+32+256) = 6
title$ = iff(info(3,6)="5","BUI","GUI") + " " + info(1,4)
text$ = "<html><head><title>BASIS</title></head><body>"
text$ = text$ + "Go to <a href=""http://basis.com/"">BASIS</a>."
text$ = text$ + "</body></html>"
text = unt
open (text,err=oops)"htmledit.html"
bytes = dec(fin(text)(1,4))
readrecord (text,siz=bytes)text$
close (unt)
oops:
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,700,500,title$,$00090093$)
window!.setCallback(window!.ON_CLOSE,"eoj")
window!.setCallback(window!.ON_RESIZE,"resize")
rem ' $0001$ = disabled, $0010$ = invisible
rem ' $0002$ = minimized toolbar, $0004$ = basic toolbar
flags$ = $0000$
if minimized then flags$ = ior(flags$,$0002$)
if basic then flags$ = ior(flags$,$0004$)
htmledit! = window!.addHtmlEdit(101,25,75,650,400,text$,flags$)
rem htmledit!.setToolTipText("BBjHtmlEdit")
htmledit!.setCallback(htmledit!.ON_PAGE_LOADED,"page")
htmledit!.setCallback(htmledit!.ON_GAINED_FOCUS,"event")
htmledit!.setCallback(htmledit!.ON_LOST_FOCUS,"event")
htmledit!.setCallback(htmledit!.ON_MOUSE_ENTER,"event")
htmledit!.setCallback(htmledit!.ON_MOUSE_EXIT,"event")
htmledit!.setCallback(htmledit!.ON_POPUP_REQUEST,"event")
htmledit!.setCallback(htmledit!.ON_RIGHT_MOUSE_DOWN,"event")
flags$ = iff(htmledit!.isEnabled(),$0004$,$0000$)
enabled! = window!.addCheckBox(1,25,25,95,25,"Enabled",flags$)
enabled!.setCallback(enabled!.ON_CHECK_ON,"enable")
enabled!.setCallback(enabled!.ON_CHECK_OFF,"disable")
flags$ = iff(htmledit!.isVisible(),$0004$,$0000$)
visible! = window!.addCheckBox(2,125,25,95,25,"Visible",flags$)
visible!.setCallback(visible!.ON_CHECK_ON,"show")
visible!.setCallback(visible!.ON_CHECK_OFF,"hide")
flags$ = iff(htmledit!.isFocusable(),$0004$,$0000$)
focusable! = window!.addCheckBox(3,225,25,95,25,"Focusable",flags$)
focusable!.setCallback(focusable!.ON_CHECK_ON,"focusable_on")
focusable!.setCallback(focusable!.ON_CHECK_OFF,"focusable_off")
flags$ = iff(htmledit!.isTabTraversable(),$0004$,$0000$)
traversable! = window!.addCheckBox(4,325,25,95,25,"Traversable",flags$)
traversable!.setCallback(traversable!.ON_CHECK_ON,"traversable_on")
traversable!.setCallback(traversable!.ON_CHECK_OFF,"traversable_off")
flags$ = iff(htmledit!.getBasicToolbar(),$0004$,$0000$)
basic! = window!.addCheckBox(5,425,25,120,25,"Basic Toolbar",flags$)
basic!.setCallback(traversable!.ON_CHECK_ON,"basic_toolbar_on")
basic!.setCallback(traversable!.ON_CHECK_OFF,"basic_toolbar_off")
focus! = window!.addToolButton(6,550,25,125,25,"Focus HtmlEdit",$$)
focus!.setCallback(focus!.ON_TOOL_BUTTON_PUSH,"focus")
window!.setVisible(1)
process_events
eoj:
release
page:
  gosub event
  print event!.getControl().getText()
return
resize:
  gosub event
  width = event!.getWidth()
  height = event!.getHeight()
  htmledit!.setSize(width-50,height-100)
return
event:
  event! = sysgui!.getLastEvent()
  event$ = event!.toString()
  event$ = event$(1,pos("@"=event$,-1)-1)
  print event$," ",event!.getControl()
return
enable:
  htmledit!.setEnabled(1)
return
disable:
  htmledit!.setEnabled(0)
return
show:
  htmledit!.setVisible(1)
return
hide:
  htmledit!.setVisible(0)
return
focusable_on:
  htmledit!.setFocusable(1)
return
focusable_off:
  htmledit!.setFocusable(0)
return
traversable_on:
  htmledit!.setTabTraversable(1)
return
traversable_off:
  htmledit!.setTabTraversable(0)
return
basic_toolbar_on:
  htmledit!.setBasicToolbar(1)
return
basic_toolbar_off:
  htmledit!.setBasicToolbar(0)
return
focus:
  htmledit!.focus()
return

See Also

BBjAPI

BBjSysGui

BBjWindow

CALLBACK Verb - Register BBj Subroutine

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.