Permalink
Browse files

add set_value method

  • Loading branch information...
1 parent b270ff4 commit 0451a73722e9bc3b4e98faadb269ab20c91c1d48 @jverzani committed May 3, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 R/gformlayout.R
View
@@ -78,6 +78,15 @@ GFormLayout <- setRefClass("GFormLayout",
names(children) <<- c(nms, label)
},
get_value=function(...) sapply(children, svalue, simplify=FALSE),
+ set_value=function(value, ...) {
+ "value a named list matching children"
+ value <- as.list(value)
+ nms <- Filter(function(i) !is.na(match(i, names(children))), names(value))
+ sapply(nms, function(nm) {
+ obj <- children[[nm]]
+ svalue(obj) <- value[[nm]]
+ })
+ },
get_dim=function() {
d <- rev(as.numeric(tcl("grid","size", widget)))
setNames(d, c("nrow", "ncol"))

0 comments on commit 0451a73

Please sign in to comment.