# Create the list to be passed
pW1 <- list(Name="AAA", Value="bbb",
toText=function(x) paste(x,collapse= ","), fromText=NULL,
canEdit=TRUE,
buttonFun = fileBrowser, buttonText = "Browse")
pW2 <- list(Name="BBB", Value="x,y,z",
toText=function(x) paste(x, collapse=","), fromText=NULL,
canEdit=TRUE, buttonFun = ls, buttonText = "List")
pW3 <- list(Name="CCC", Value="ccc",
toText=function(x) paste(x, collapse = ","), fromText=NULL,
canEdit=TRUE, buttonFun=NULL, buttonText=NULL)
widget1 <- list(wList = list(a = pW1, b = pW2, c = pW3),
preFun = function() "Hi",
postFun = function() "Bye")
# Call the function
if(interactive()){
x <- widgetRender(widget1, "Test Widget")
str(x)
}
Run the code above in your browser using DataCamp Workspace