A list box with constant number of rows.

bs_listbox(
  parent,
  values = variables_all(),
  value = NULL,
  selection = NULL,
  selectmode = c("single", "extended", "browse", "multiple"),
  title = NULL,
  subtitle = NULL,
  tip = "",
  height = getRcmdr("variable.list.height"),
  width = getRcmdr("variable.list.width"),
  enabled = TRUE,
  scroll = c("both", "x", "y", "none"),
  autoscroll = c("x", "y", "both", "none"),
  use_filter = FALSE,
  filter_label = "Filter",
  sticky = "nw",
  on_select = do_nothing,
  on_click = do_nothing,
  on_double_click = do_nothing,
  on_triple_click = do_nothing,
  on_release = do_nothing,
  on_click_3 = do_nothing,
  on_double_click_3 = do_nothing,
  on_triple_click_3 = do_nothing,
  on_release_3 = do_nothing,
  on_keyboard = c("select", "scroll", "ignore"),
  on_keyboard_fun = do_nothing,
  bind_row_swap = FALSE,
  title_sticky = "w",
  subtitle_sticky = title_sticky,
  title_color = getRcmdr("title.color"),
  subtitle_color = "black",
  filter_label_color = title_color,
  ...
)

# S3 method for listbox
get_size(obj, ...)

# S3 method for tkwin
get_size(obj, ...)

get_values_listbox(listbox, trim = FALSE)

# S3 method for listbox
get_values(obj, ...)

# S3 method for tk2listbox
get_values(obj, vals, ...)

set_values_listbox(listbox, values, clear = TRUE, ignore_on_disabled = FALSE)

# S3 method for listbox
set_values(obj, values, ..., clear = TRUE)

# S3 method for tk2listbox
set_values(obj, values, ..., clear = TRUE)

# S3 method for listbox_with_filter
set_values(obj, values, ..., clear = TRUE)

get_selection_ind_listbox(listbox)

get_selection_listbox(listbox)

# S3 method for listbox
get_selection(obj, ..., index = FALSE)

# S3 method for tk2listbox
get_selection(obj, ..., index = FALSE)

# S3 method for listbox
get_selection_length(obj, ...)

# S3 method for tk2listbox
get_selection_length(obj, ...)

set_selection_listbox(listbox, sel, clear = TRUE)

# S3 method for listbox
set_selection(obj, sel, clear = TRUE, ...)

# S3 method for tk2listbox
set_selection(obj, sel, clear = TRUE, ...)

# S3 method for listbox
add_selection(obj, sel, ...)

# S3 method for tk2listbox
add_selection(obj, sel, ...)

move_selected_row_in_box(tkobj, move_to = "+1")

move_selection_in_box(tkobj, move_to = "+1")

move_selected_row_in_listbox__previous_version(listbox, move_to = "")

# S3 method for listbox
tk_bind_row_swap(obj, ...)

# S3 method for tk2listbox
tk_bind_row_swap(obj, ...)

# S3 method for listbox
set_yview(obj, ind, ...)

# S3 method for tk2listbox
set_yview(obj, ind, ...)

# S3 method for listbox
get_yview(obj, ...)

# S3 method for tk2listbox
get_yview(obj, ...)

# S3 method for listbox
tk_yview_moveto(obj, ...)

# S3 method for tk2listbox
tk_yview_moveto(obj, ...)

# S3 method for listbox
tk_see(obj, ind, ...)

# S3 method for tk2listbox
tk_see(obj, ind, ...)

# S3 method for listbox
tk_get_state(obj, ...)

# S3 method for tk2listbox
tk_get_state(obj, ...)

# S3 method for listbox
tk_disable(obj, ..., background = "grey95")

# S3 method for tk2listbox
tk_disable(obj, ..., background = "grey95")

# S3 method for listbox_with_filter
tk_disable(
  obj,
  ...,
  background = "grey95",
  ignore_filter = FALSE,
  clear_filter = !ignore_filter
)

# S3 method for listbox
tk_normalize(obj, ..., background = "white")

# S3 method for tk2listbox
tk_normalize(obj, ..., background = "white")

# S3 method for listbox_with_filter
tk_normalize(obj, ..., background = "grey95")

# S3 method for listbox
tk_enable(obj, ..., background = "white")

# S3 method for tk2listbox
tk_enable(obj, ..., background = "white")

# S3 method for listbox_with_filter
tk_enable(obj, ..., background = "grey95")

Arguments

parent

Parent TCL/TK frame.

values

(character) Vector of possible values.

value

(character or NULL) Values that should be initially selected.

selection

(integer) Numeric indices of initially selected lines. Can be used instead of value.

selectmode

("single", "extended", "browse", "multiple") Selection mode.

title

(string) Title.

subtitle

(string) Subtitle.

tip

(string) Message that is displayed on muse hover.

height

(integer) Height of list box in lines.

width

(one or two integers) Minimum and maximum width of list box.

enabled

(logical) If TRUE, widget is enabled by default.

scroll

("both", "x", "y", "none") Do we add scrollbars? Indicates scrollbar position.

autoscroll

("x", "y", "both", "none") Do we automatically hide scrollbars if not needed? Indicates scrollbar position.

use_filter

(logical) Should list box values filter box be displayed.

filter_label

(string) Label for filter entry box.

sticky

(combination of "n", "e", "w", "s" or "").

on_select

Function that is activated on value selection.

on_click

Function that is activated on single left-click.

on_double_click

on double left-click.

on_triple_click

Function that is activated on triple left-click.

on_release

Function that is activated on release of left-click.

on_click_3

Function that is activated on single right-click.

on_double_click_3

Function that is activated on double right-click.

on_triple_click_3

Function that is activated on triple right-click.

on_release_3

Function that is activated on release of right-click.

on_keyboard

("select", "scroll", "ignore") Action on keyboard letter click:

"select"

toggle selection of values that start with the pressed letter. This letter binding is good for single-selection boxes, otherwise selection should not be toggled (see "scroll")

"scroll"

toggle view of values that start with the pressed letter. Do not toggle selection (i.e., do not select or deselect).

"ignore"

Do not bind any action. Letter binding is good for read-only list boxes only.

on_keyboard_fun

Function that is activated on keyboard button press, if on_keyboard is "select" or "scroll".

bind_row_swap

(Does not work yet!) if TRUE, Ctrl/Alt + Up/Down keys move rows in the list box

title_sticky

(combination of "n", "e", "w", "s" or "")

subtitle_sticky

(combination of "n", "e", "w", "s" or "")

title_color, subtitle_color, filter_label_color

The colors of widget elements.

...

Additional arguments.

  1. For bs_listbox(): arguments passed to function tk2listbox() (see tk2widgets).

  2. For other functions: arguments passed to further methods.

obj

Widget.

listbox

List box widget.

trim

(logical) Should the whitespace characters be trimmed from the beginning and the end of each string?

vals

Values.

clear

(logical) Should values be cleared?

ignore_on_disabled

(logical) Should the procedure be ignored (not performed) if a widget is disabled?

index

(logical) Is provided input an index? `TRUE` -- index, `FALSE` -- value.

sel

Selection. Usually either character values or numeric indices.

tkobj

Tcl/Tk object.

move_to

(string) Action:

  • "top" - selected row is moved to the first row.

  • "-1" - position is decreased by 1 row.

  • "+1" - position inreased by 1row.

  • "end" - selected row is moved to the last row.

ind

Index. Usually either character values or numeric indices.

background

(character) Background color.

ignore_filter

(logical) Should disabling/enabling of filter be ignored?

clear_filter

(logical) Should the filter be cleared an values of listbox reset?

See also

Examples