View source: R/bs_checkboxes.R
bs_checkboxes | R Documentation |
Checkboxes widget with command functions and tips when mouse is over the box.
bs_checkboxes(
parent = top,
boxes,
labels = NULL,
title = NULL,
values = NULL,
default_value = "0",
commands = list(),
default_command = function() {
},
tips = list(),
default_tip = "",
border = FALSE,
layout = c("vertical", "horizontal"),
sticky_buttons = "w",
sticky_title = "w"
)
parent |
Parent frame. |
boxes |
(vector of strings) Variable names for each checkbox. |
labels |
(vector of strings) Labels for each checkbox. |
title |
Title for the set of checkboxes. |
values |
A vector of values ("0" or "1"). Overrides the 'default_value'. |
default_value |
(string) Default value ("0" or "1"). |
commands |
A named list of commands (functions) for checkbox. The names must match the values of "boxes". |
default_command |
(function) A default command. |
tips |
A named list of strings to be used as tips for checkbox. The names must match the values of "boxes". |
default_tip |
(string) a default tip. |
border |
(logical) Flag if the frame should have a border. |
layout |
(string) One of "vertical" (default) and "horizontal". |
sticky_buttons |
(string) 'sticky' option for buttons. |
sticky_title |
(string) 'sticky' option for title (if no border is used). |
A named list with fields 'frame' (frame with the checkboxes), 'var' (tcl/tk variables for each box), and 'obj' (tcl/tk objects for each box).
## Not run: \donttest{
library(RcmdrPlugin.biostat)
top <- tcltk::tktoplevel()
boxes_1 <- bs_checkboxes(top, c("A", "B", "C"))
tcltk::tkgrid(boxes_1$frame)
top <- tcltk::tktoplevel()
boxes_2 <- bs_checkboxes(top, boxes = c("A", "B", "C"), border = TRUE)
tcltk::tkgrid(boxes_2$frame)
top <- tcltk::tktoplevel()
boxes_3 <- bs_checkboxes(top, c("A", "B", "C"),
layout = "h", title = "Buttons")
tcltk::tkgrid(boxes_3$frame)
set_values(boxes_3, B = TRUE, C = TRUE)
new_vals <- c(A = TRUE, B = FALSE)
set_values(boxes_3, new_vals)
get_values(boxes_3)
get_values(boxes_3, "B")
get_values(boxes_3, simplify = FALSE)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.