
BBjControl::addStyle
Description
In BBj 11.0 and higher, this method adds a CSS style name to the BBjControl.
Syntax
ReturnValue |
Method |
boolean |
addStyle(string styleName) |
Parameters
Variable |
Description |
styleName |
Specifies a style name to be added to the control. |
Return Value
Returns whether the style name was added to the control.
Remarks
For more details, see CSS API.
Example
Copy
CSS Sampler
rem ' CSS sampler
sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
window! = sysgui!.addWindow(50,50,325,250,"CSS Sampler",$00090003$)
window!.setCallback(window!.ON_CLOSE,"eoj")
getStyles! = window!.addButton(1,25,25,125,25,"getStyles",$$)
getStyles!.setCallback(getStyles!.ON_BUTTON_PUSH,"getStyles")
clearStyles! = window!.addButton(2,175,25,125,25,"clearStyles",$$)
clearStyles!.setCallback(clearStyles!.ON_BUTTON_PUSH,"clearStyles")
text$ = "The quick brown fox jumps over the lazy dog."
edit! = window!.addEditBox(100,25,75,275,50,text$,$$)
border! = window!.addCheckBox(101,25,150,275,25,"borderStyle",$$)
border!.setCallback(border!.ON_CHECK_ON,"addStyle")
border!.setCallback(border!.ON_CHECK_OFF,"removeStyle")
shadow! = window!.addCheckBox(102,25,175,275,25,"shadowStyle",$$)
shadow!.setCallback(shadow!.ON_CHECK_ON,"addStyle")
shadow!.setCallback(shadow!.ON_CHECK_OFF,"removeStyle")
background! = window!.addCheckBox(103,25,200,275,25,"backgroundStyle",$$)
background!.setCallback(background!.ON_CHECK_ON,"addStyle")
background!.setCallback(background!.ON_CHECK_OFF,"removeStyle")
process_events
eoj:
release
getStyles:
i = msgbox(edit!.getStyles().toString(),0,"getStyles")
return
clearStyles:
border!.setSelected(0)
shadow!.setSelected(0)
background!.setSelected(0)
edit!.clearStyles()
return
addStyle:
event! = sysgui!.getLastEvent()
control! = event!.getControl()
style$ = control!.getText()
edit!.addStyle(style$)
return
removeStyle:
event! = sysgui!.getLastEvent()
control! = event!.getControl()
style$ = control!.getText()
edit!.removeStyle(style$)
return
CSS Example
Copy
CSS Example
.backgroundStyle
{
background: rgb(242,245,246);
background: -moz-linear-gradient(top, rgba(242,245,246,1) 0%, rgba(227,234,237,1) 37%, rgba(200,215,220,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(242,245,246,1)), color-stop(37%,rgba(227,234,237,1)), color-stop(100%,rgba(200,215,220,1)));
background: -webkit-linear-gradient(top, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%);
background: -o-linear-gradient(top, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%);
background: -ms-linear-gradient(top, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%);
background: linear-gradient(to bottom, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f5f6', endColorstr='#c8d7dc',GradientType=0 );
}
.borderStyle
{
border-radius: 15px;
border-width: 2px;
}
.shadowStyle
{
box-shadow: 7px 7px 5px rgba(50, 50, 50, 0.5);
}
See Also
See the BBj Object Diagram for an illustration of the relationship between BBj Objects.