bs_checkboxes: Checkboxes widget.

View source: R/bs_checkboxes.R

bs_checkboxesR Documentation

Checkboxes widget.

Description

Checkboxes widget with command functions and tips when mouse is over the box.

Usage

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"
)

Arguments

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).

Value

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).

Examples

## 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)

GegznaV/RcmdrPlugin.BioStat documentation built on May 8, 2023, 7:41 a.m.