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

bs_radiobuttons(
  parent = top,
  buttons,
  value = buttons[1],
  title = NULL,
  variable = NULL,
  labels = NULL,
  commands = list(),
  default_command = do_nothing,
  tips = list(),
  default_tip = "",
  border = FALSE,
  layout = c("vertical", "horizontal"),
  sticky_buttons = "w",
  sticky_buttons_frame = "",
  sticky_title = "w"
)

Arguments

parent

Parent frame.

buttons

(vector of strings) Value names for each radiobutton.

value

(string) Initial value. One of `buttons` values.

title

Title for the set of radiobuttons.

variable

Tcl/Tk variable. Is `NULL`, a new variable will be created.

labels

(vector of strings) Labels for each radiobutton.

commands

A named list of commands (functions) for radiobutton. The names must match the values of "buttons".

default_command

(function) A default command.

tips

A named list of strings to be used as tips for radiobutton. The names must match the values of "buttons".

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) tkgrid `sticky` option for buttons.

sticky_buttons_frame

(string) tkgrid `sticky` option for buttons frame

sticky_title

(string) tkgrid `sticky` option for title (if no border is used).

Value

A named list with fields `frame` (frame with the radiobuttons), `var` (tcl/tk variables for each box), and `obj` (tcl/tk objects for each box).

Examples

if (FALSE) { # \dontrun{

top <- tcltk::tktoplevel()

buttons_1 <- bs_radiobuttons(top, c("A", "B", "C"))
tcltk::tkgrid(buttons_1$frame)


top <- tcltk::tktoplevel()
buttons_2 <- bs_radiobuttons(top, buttons = c("A", "B", "C"),
  border = TRUE, title = "Buttons")
tcltk::tkgrid(buttons_2$frame)


top <- tcltk::tktoplevel()
buttons_3 <- bs_radiobuttons(top, c("A", "B", "C"), layout = "h",
  title = "Buttons", sticky_buttons = "")
tcltk::tkgrid(buttons_3$frame)
} # }