Last data update: 2014.03.03

R: Accessors for Primitive Widget Objects
WNameR Documentation

Accessors for Primitive Widget Objects

Description

Currently primitive widget objects (pwidgets) are implemented as lists, but this will change. Users should only rely on these accessors functions, not the implementation.

Usage

WName(x)
WValue(x)
WValue(x) <-  value
WtoText(x)
WfromText(x)
WcanEdit(x)
WbuttonText(x)
WbuttonFun(x)
WwList(x)
WwList(x) <- value
WLValue(x, index)
WLValue(x, index) <- value
WRButtons(x)
WpreFun(x)
WpostFun(x)
WEnd(x)

Arguments

x

list of lists with a Name, Value, toText, fromText, canEdit, buttonText, buttonFun, preFun, postFun element.

index

integer or character string as an index or name for the list in the first list of a list of lists for a widget.

value

An R data type that is going to be used to update the value.

Details

WName(x) returns the Name element of x. WValue(x) returns the Value element of x. WValue(x) <- value will change the Value element of x to value.

WtoText(x) returns the toText element of x. WfromText(x) returns the fromText element of x. WcanEdit(x) returns the canEdit element of x.

WbuttonText(x) returns the buttonText element of x. WbuttonFun(x) returns the buttonFun element of x. WwList(x) returns the wList element of x. WwList <- value will update the wList element of a Widget list with value.

WLValue(x, index) returns a list indicated by the index in the wList of a widget list. WLValue(x, index) <- value will update indicated by the index in the wList of a widget list with the value.

WpreFun(x) returns the preFun element of x. WpostFun(x) returns the post element of x. WEnd(x) returns the end element of x.

Value

A character string or R function represented by the element of the list whose value is to be retrieved.

Author(s)

Jianhua (John) Zhang

See Also

widgetRender for references etc.

Examples

# Create the list of lists
pW1 <- list(Name="AAA", Value="bbb",
            toText = function(x) paste(x,collapse = ","),
            fromText = NULL, canEdit = TRUE,
            buttonFun = ls, buttonText = "Browse")

widget1 <- list(wList = list(a = pW1),
                preFun = function() "Hi",
                postFun = function() "Bye")

# Call the functions
WName(pW1)
WValue(pW1)
WValue(pW1) <- "lll"
WtoText(pW1)
WfromText(pW1)
WcanEdit(pW1)
WbuttonText(pW1)
WbuttonFun(pW1)
WwList(widget1)
WwList(widget1) <- list(Name = "New list", Value = "New value")
WLValue(widget1, 1)
WLValue(widget1, 1) <- "New value"
WpreFun(widget1)
WpostFun(widget1)
WEnd(widget1)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(tkWidgets)
Error in library(tkWidgets) : there is no package called 'tkWidgets'
Execution halted