A checkbox shows a value and a box to check indicating if the value is desired or not.
gcheckbox(text, checked = FALSE, use.togglebutton=FALSE, handler = NULL, action = NULL,
container = NULL, ..., toolkit = guiToolkit())
Text to show by box
Logical indicating initial state of box
Logical indicating if a toggle button should be used (depresses when TRUE
) in place of a check box
Called when box is toggled.
Passed to handler
Optional container to attach widget to.
Not documented, currently has no role.
Which toolkit to use?
The value of the widget is either TRUE
or FALSE
.
The svalue
method returns a logical indicating
TRUE
if the box is checked.
The svalue<-
method can be used to set the value
using a logical.
The "["
method returns the label on the box.
The "[<-"
method can be used to change the label on the
box.
The default handler is set by the addHandlerClicked
method. This is called when the button is
toggled. If one wishes to have the handler called only when
checked to indicate TRUE
, say, one should check the state
of the widget in the handler (e.g., if(svalue(h$obj))
).
Methods for gComponent objects are detailed in gWidgets-methods
.
Event Handlers are detailed in gWidgets-handlers
.
# NOT RUN {
gcheckbox("checked", container=TRUE, handler=function(h,...) {
cat("The widget is checked?",svalue(h$obj), "\n")
})
# }
Run the code above in your browser using DataLab