WName: Accessors for Primitive Widget Objects

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/renderFuns.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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)

tkWidgets documentation built on Nov. 8, 2020, 5:17 p.m.