setWidgetColor | R Documentation |
Update the foreground and background colors of a widget
setWidgetColor(name, radioValue, winName = .PBSmodEnv$.PBSmod$.activeWin, ...)
name |
the name of the widget |
radioValue |
if specified, modify a particular radio option, as identified by the value, rather than the complete set (identified by the common name) |
winName |
window from which to select the GUI widget. The window that most recently receive user input is used by default if winname is not supplied |
... |
any combination of "fg", "bg", "disablefg", "disablebg", "entryfg", "entrybg", "noeditfg", "noeditbg" arguments, depending on type of widget - see details |
The setWidgetColor function allows dynamic updating of widget colors during program execution. However, two factors determine whether dynamic color updating is possible for a particular widget: (i) the type of widget, and (ii) the nature of the Tk implementation in the underlying widget library. Thus, a given widget may not support all combinations of colour variables. The following widgets support the corresponding options:
fg, bg, disablefg
fg, bg, disablefg, entryfg, entrybg
entryfg, entrybg, noeditfg, noeditbg
fg, bg
entryfg, entrybg, noeditfg, noeditbg
fg, bg
entryfg, entrybg, noeditfg, noeditbg
entryfg, entrybg, noeditfg, noeditbg
fg, bg
fg, bg
fg, bg
entryfg, entrybg
fg, bg
entryfg, entrybg, noeditfg, noeditbg
These options are described in the PBSmodelling User Guide under Appendix A.
Be aware that Tk uses gray for the highlight color during a selection operation. This means that when the background colour is also gray, there is no visual clue that the value has been selected for a copy operation.
Alex Couture-Beil (VIU, Nanaimo BC) and Allen R. Kronlund (PBS, Nanaimo BC)
## Not run:
local(envir=.PBSmodEnv,expr={
createWin("label \"hello world\" name=hello", astext=TRUE)
setWidgetColor( "hello", bg="lightgreen", fg="purple" )
})
local(envir=.PBSmodEnv,expr={
createWin("vector names=v length=3 values=\"1 2 3\"", astext=TRUE)
setWidgetColor( "v[1]", entrybg="lightgreen", entryfg="purple" )
setWidgetColor( "v[2]", entrybg="green", entryfg="purple" )
setWidgetColor( "v[3]", entrybg="forestgreen", entryfg="purple" )
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.