tkWidgets (version 1.50.0)

WName: 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.

Value

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

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.

See Also

widgetRender for references etc.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab