constructor for checkbox widget
A checkbox widget is used to toggle the state of a labeled boolean
variable. The main property of this widget is that state, not the
label. This variable may be proxied in the usual way – with a box
that indicates or check if TRUE
– or through a toggle
button.
Generic for toolkit dispatch
The change handler for GCheckbox
is called when the value
toggles. You can inpsect the current value in the callback to have
an action based on the state.
The object state is referred to by svalue as a logical (TRUE for checked).
The svalue<-
method ensures the value is a logical vector
of length 1.
The item to select is referred to by the [
method, with only the first element being used.
gcheckbox(text = "", checked = FALSE, use.togglebutton = FALSE, handler = NULL, action = NULL, container = NULL, ..., toolkit = guiToolkit()) .gcheckbox(toolkit, text, checked = FALSE, use.togglebutton = FALSE, handler = NULL, action = NULL, container = NULL, ...) ## S3 method for class 'GCheckbox' addHandlerChanged(obj, handler, action = NULL, ...) ## S3 replacement method for class 'GCheckbox' svalue(obj, index=NULL, ...) <- value ## S3 replacement method for class 'GCheckbox' x[i, j, ...] <- value
text |
label text |
checked |
is button selected |
use.togglebutton |
Use a toggle button (shows depressed) not a check box |
handler |
Callback called when toggle is changed. |
action |
passed to handler |
container |
parent container |
... |
passed to |
toolkit |
toolkit |
obj |
receiver object |
index |
ignored. Input is coerced to logical. |
value |
assignment value |
x |
checkbox object |
i |
item index |
j |
ignored |
Returns an object of class GCheckbox
.
The value is coerced to character, then only first element used for checkbox label
if(interactive()) { w <- gwindow("Selection widgets") g <- gvbox(cont=w) fl <- gformlayout(cont=g) gcheckbox("checkbox", checked=TRUE, cont=fl, label="checkbox") gradio(state.name[1:4], selected=2, horizontal=TRUE, cont=fl, label="gradio") gcheckboxgroup(state.name[1:4], horizontal=FALSE, cont=fl, label="checkbox group") bg <- ggroup(cont=g) gbutton("ok", cont=bg, handler=function(h,...) print(sapply(fl$children, svalue))) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.