rem ' BBjHtmlEdit::getBasicToolbarStyles
client = 0
if (info(3,6)<>"5" and info(3,6)<>"6") then
client = msgbox("BBjHtmlEdit Client",7+32+512,"BBjHtmlEdit","Swing","JavaFX","Chromium")
switch client
case 1; rem ' Swing
print stbl("!OPTIONS","CHROMIUM_HTMLEDIT=FALSE",ERR=*NEXT)
print stbl("!OPTIONS","JAVAFX_HTMLEDIT=FALSE",ERR=*NEXT)
break
case 2; rem ' JavaFX
print stbl("!OPTIONS","CHROMIUM_HTMLEDIT=FALSE",ERR=*NEXT)
print stbl("!OPTIONS","JAVAFX_HTMLEDIT=TRUE",ERR=*NEXT)
break
case 3; rem ' Chromium
print stbl("!OPTIONS","CHROMIUM_HTMLEDIT=TRUE",ERR=*NEXT)
print stbl("!OPTIONS","JAVAFX_HTMLEDIT=TRUE",ERR=*NEXT)
break
swend
endif
basic = msgbox("Basic toolbar?",4+32) = 6
minimized = 0
minimized = msgbox("Initially minimized toolbar?",4+32+256) = 6
title$ = iff(info(3,6)="5","BUI",iff(info(3,6)="6","DWC","GUI")) + " " + info(1,4)
text$ = "<html><head><style>p{margin:0;padding:0;}</style><title>BASIS</title></head><body>"
img$ = "https://www.basis.cloud/images/BusJGBetter.jpg"
text$ = text$ + "<img src="""+img$+""">"
url$ = "https://documentation.basis.cloud/BASISHelp/WebHelp/bbjobjects/Window/bbjhtmledit/BBjHtmlEdit.htm"
text$ = text$ + "<p>This is a <a href="""+url$+""">BBjHtmlEdit</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(0,25,25,850,550,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,800,450,text$,flags$)
print "getClientType: ",htmledit!.getClientType(err=*next)
print "getClientVersion: ",htmledit!.getClientVersion(err=*next)
title$ = window!.getTitle() + " " + htmledit!.getClientType(err=*next) + " " + htmledit!.getClientVersion(err=*next)
window!.setTitle(title$)
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,90,25,"Focus",$$)
focus!.setCallback(focus!.ON_TOOL_BUTTON_PUSH,"focus")
showToolbarStyles! = window!.addToolButton(7,650,25,175,25,"setBasicToolbarStyles",$$)
showToolbarStyles!.setCallback(showToolbarStyles!.ON_TOOL_BUTTON_PUSH,"showToolbarStyles")
window!.setVisible(1)
x = window!.getX() + window!.getWidth()
y = window!.getY()
w = 600
h = window!.getHeight()
styles! = sysgui!.addWindow(1,x,y,w,h,"toolbarStyles",$00090093$)
styles!.setCallback(styles!.ON_CLOSE,"hideToolbarStyles")
allStyles! = htmledit!.getAllToolbarStyles()
java.util.Collections.sort(allStyles!)
basicStyles! = new java.util.HashSet(htmledit!.getBasicToolbarStyles())
x = 25
y = 25
w = 200
h = 25
styles = allStyles!.size()
if (styles) then
for style = 0 to styles - 1
style$ = allStyles!.get(style)
flags$ = iff(basicStyles!.contains(style$),$0004$,$0000$)
style! = styles!.addCheckBox(style+100,x,y,w,h,style$,flags$)
style!.setCallback(style!.ON_CHECK_ON,"addBasicStyle")
style!.setCallback(style!.ON_CHECK_OFF,"removeBasicStyle")
y = y + h
if y > 500 then y = 25, x = x + w
next style
endif
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()
print event!.getEventName()," ",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
showToolbarStyles:
styles!.setVisible(1)
styles!.focus()
return
hideToolbarStyles:
styles!.setVisible(0)
window!.focus()
return
addBasicStyle:
style$ = sysgui!.getLastEvent().getControl().getText()
rem 'print "addBasicStyle ",style$
basicStyles!.add(style$)
gosub setBasicToolbarStyles
return
removeBasicStyle:
style$ = sysgui!.getLastEvent().getControl().getText()
rem 'print "removeBasicStyle ",style$
basicStyles!.remove(style$)
gosub setBasicToolbarStyles
return
setBasicToolbarStyles:
vector! = bbjapi().makeVector()
iter! = basicStyles!.iterator()
while iter!.hasNext()
vector!.add(iter!.next())
wend
print "htmledit!.setBasicToolbarStyles(",vector!,")"
htmledit!.setBasicToolbarStyles(vector!)
return
|