BUI logoDWC logoBBjWebManager::injectStyle

Description

In BBj 22.03 and higher, this method injects the specified CSS into the web page.

Note:

In BBj 22.03 and higher, BBjWebManager is an alias for BBjBuiManager.

Syntax

Return Value Method

void

injectStyle(String style)
void injectStyle(String style, boolean top)
void injectStyle(String style, boolean top, String attributes)

void

injectStyle(String style, boolean top, HashMap attributes)

Parameters

Parameter Description
style CSS to be injected into this web page.
top A boolean value specifying whether this CSS is to be injected into the top level window of the page.
attributes A set of attributes to be added to the style element. Attributes can be specified either as a string in the format "attr=value,attr=value" or as a HashMap containing key/value pairs.

Return Value

None.

Example

rem ' BBjWebManager::injectStyle

style$ = "body { background-color: yellow !important; }"
top = 1
attributes$ = ""

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()

title$ = "BBjWebManager::injectStyle"
window! = sysgui!.addWindow(25,25,600,225,title$,$00090083$)
window!.setCallback(window!.ON_RESIZE,"resize")
window!.setCallback(window!.ON_CLOSE,"eoj")

window!.addStaticText(101,5,25,90,25,"Style:",$8000$)
style! = window!.addEditBox(102,100,25,475,25,style$,$$)

top! = window!.addCheckBox(103,100,75,475,25,"Top",$$)
top!.setSelected(top)

window!.addStaticText(104,5,125,90,25,"Attributes:",$8000$)
attributes! = window!.addEditBox(105,100,125,475,25,attributes$,$$)

injectStyle! = window!.addButton(1,100,175,475,25,"injectStyle",$$)
injectStyle!.setCallback(injectStyle!.ON_BUTTON_PUSH,"injectStyle")

browser! = bbjapi().getWebManager(err=oops)

process_events

oops:
i = msgbox("This functionality is only supported in browser environments.")

eoj:
release

resize:
    event! = sysgui!.getLastEvent()
    width = event!.getWidth()
    height = event!.getHeight()
    style!.setSize(width-125,25)
    top!.setSize(width-125,25)
    attributes!.setSize(width-125,25)
    injectStyle!.setSize(width-125,25)
return

injectStyle:
    style$ = style!.getText()
    top = top!.isSelected()
    attributes$ = attributes!.getText()
    browser!.injectStyle(style$, top, attributes$)
return

See Also

BBjAPI

BBjSysGui

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.