button {widgetTools}R Documentation

Functions to construct objects of primary widgets and render them

Description

All the primary widgets such as button, text box, and so on are objects of basicPW class. The functions are constructors of primary widgets that are subjects of basicPW class with behaviors specific to primary widgets.

Usage

button(wName, wEnv, wValue = "", wWidth = 12, wHeight = 0, wFuns = list(),
wNotify = list(), wPreFun = function(x) x, wPostFun = function(x) x,
wView = new("widgetView") )
entryBox(wName, wEnv, wValue = "", wWidth = 50, wHeight = 0, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
textBox(wName, wEnv, wValue = "", wWidth = 25, wHeight = 12, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
listBox(wName, wEnv, wValue = "", wWidth = 25, wHeight = 10, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
checkButton(wName, wEnv, wValue, wWidth = 50, wFuns = list(), wNotify =
list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
radioButton(wName, wEnv, wValue, wWidth = 50, wFuns = list(), wNotify =
list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
label(wName, wEnv, wValue = "", wWidth = 0, wHeight = 0, wFuns = list(),
wNotify = list(), wPreFun = function (x) x, wPostFun = function(x) x,
wView = new("widgetView"))
widget(wTitle, pWidgets, funs = list(), preFun = function()
print("Hello"), postFun = function() print("Bye"), env, defaultNames =c(
"Finish", "Cancel"))
widgetView(WVTitle, vName, widgetids = list(), theWidget = new("widget"),
winid)

Arguments

wName wName a character string for the name to be associated with a given primary widget
vName vName same as wName but for a widget object
wEnv wEnv an R environment object within which the original values for each primary widget will be stored and updating and retrieval of the values will take place
env env same as wEnv but for a widget object
wValue wValue the initial values to be associated with a given primary widget
wWidth wWidth an integer for the width of the primary widget (if applicable)
wHeight wHeight an integer for the height of the primary widget (if applicable)
wFuns wFuns a list of R functions that will be associated with a primary widget and invoked when an operation (e.g. click, get focus, ...) is applied to the primary widget
funs funs same as wFuns but for a widget object
wNotify wNotify a list of functions defining the actions to be performed when the value of the primary widget changes
wPreFun wPreFun an R function that should be applied when the widget is activated
preFun preFun same as wPreFun but for a view
wPostFun wPostFun an R function that will be applied when the widget is inactivated
postFun postFun same as wPostFun but for a view
wTitle wTitle a character string for the title to be displayed when the widget is rendered
pWidgets pWidget a list of primary widgets (e.g. button, list box, ...) to be rendered
WVTitle WVTitle same as wTitle
widgetids widgetids a list of tkwin ids for the primary widgets to be rendered
theWidget theWidget a widget object to render the primary widgets
wView wView an object of class widgetView
winid winid an object of class winid
defaultNames defaultName a vector of character string of length two for the text to be shown on the two default buttons. The first is to end the process and the second to abort the process

Details

button constructs a button widget object.

button constructs an entry box widget object.

textBox constructs a text box widget object.

listBox constructs a list box widget object. Value for a listbox object should be a named vector with names being the content to be shown in the list box and values being TRUE (default value) or FALSE.

checkButton constructs a group of check box widget objects. Value for check button objects should be a named vector with names being the content to be shown in the list box and values being TRUE (checked) or FALSE (not checked).

radioButton constructs a group of radio button widget objects. Value for radio button objects should be a named vector with names being the content to be shown in the list box and values being TRUE (default) or FALSE.

label constructs a text label widget object with the value displayed as the text.

widget constructs a widget object to render the primary widgets.

widgetView constructs a widgetView object. This class is for internal use by class widget-class. Users trying to create GUI type widget do not need to use this class.

Value

Each constructor returns a tkwin object for the primary widget object.

Note

The functions are part of the Bioconductor project at Dana-Farber Cancer Institute to provide Bioinformatics functionalities through R

Author(s)

Jianhua Zhang

References

R tcltk

See Also

widget-class, basicPW-class

Examples

# Create an R environment to store the values of primary widgets
PWEnv <- new.env(hash = TRUE, parent = parent.frame(1))

# Create a label
label1 <- label(wName = "label1", wValue = "File Name: ", wEnv = PWEnv)

# Create an entry box with "Feed me using brows" as the default value
entry1 <- entryBox(wName = "entry1", wValue = "Feed me using browse",
                   wEnv = PWEnv)

# Create a button that will call the function browse2Entry1 when
# pressed.
browse2Entry1 <- function(){
    tempValue <- tclvalue(tkgetOpenFile())
    temp <- get(wName(entry1), env = PWEnv)
    wValue(temp) <- paste(tempValue, sep = "", collapse = ";")
    assign(wName(entry1), temp, env = PWEnv)
}
button1 <- button(wName = "button1", wValue = "Browse",
                     wFuns = list(command = browse2Entry1), wEnv = PWEnv)

# Create a list box with "Option1", "Option2", and "Option3" as the
# content and "Option1" selected
list1 <- listBox(wName = "list1", wValue = c(Option1 = TRUE, Option2 = FALSE,
                                 Option3 = FALSE), wEnv = PWEnv)

# Create a text box with "Feed me something" displayed
text1 <- textBox(wName = "text1", wValue = "Feed me something",
                 wEnv = PWEnv)

# Create a set of radio buttons with "radio1" as the default
label2 <- label(wName = "label2", wValue = "Select one:  ", wEnv = PWEnv)
radios1 <- radioButton(wName = "radios1", wValue = c(radio1 = TRUE,
                       radio2 = FALSE, radio3 = FALSE), wEnv = PWEnv)

# Create a set of check boxes with "check1" selected and "check2" and
# "check3" not selected
label3 <- label(wName = "label3", wValue = "Select one to many: ",
wEnv = PWEnv)
checks1 <- checkButton(wName = "checks1", wValue = c(check1 = TRUE,
                       check22 = FALSE, check3 = FALSE), wEnv = PWEnv)

# Please not that the name of the primary widget object (e.g. checks1)
# should be the same as the value of the name slot of the object
# (e. g. name = "checks1")

# Render the widgets
pWidgets <- list(topRow = list(label1 = label1, entry1 = entry1,
                 button1 = button1), textRow = list(list1 = list1,
                 text1 = text1), radGroup = list(label2 = label2,
                 radios1 = radios1), chkGroup = list(label3 = label3,
                                     checks1 = checks1))
## Not run: 
## These cannot be run by examples() but should be OK when pasted
## into an interactive R session with the widgetTools package loaded

aWidget <- widget(wTitle = "A test widget", pWidgets, funs = list(),
                 preFun = function() print("Hello"),
                 postFun = function() print("Bye"), env = PWEnv)
## End(Not run) 

[Package widgetTools version 1.6.0 Index]