[R-gui] gWidgets: several statusbars per window?
Liviu Andronic
landronimirc at gmail.com
Fri Feb 26 16:10:02 CET 2010
Dear all
I would like to have one "status area" per container, hence several in
a window. The problem with gstatusbar() is that it can only be
attached to a window, and the result is not very clean. Please see the
code below.
Is there a way to attach a "status area" to a container? Thank you
Liviu
count.mv.int <- function(x, start=1, end=2){
assign("i", x, envir = .GlobalEnv)
print(paste("i = ", i))
return(paste("i = ", i))
}
count.mv.int(2); i
count.mv.let <- function(x, start=1, end=4){
assign("l", letters[x], envir = .GlobalEnv)
print(paste("l = ", l))
return(paste("l = ", l))
}
count.mv.let(3); l
count.pop4 <- function(fun=c("count.mv.int", "count.mv.let")){
require(gWidgets)
options(guiToolkit="tcltk")
w <- gwindow(paste("Counters (lapply)"))
g <- ggroup(cont=w, horizontal=T)
x.fun <- function(k){
x.cont <- paste("g", i, sep="")
assign(x.cont, ggroup(cont=g, horizontal=FALSE))
glabel(paste("'", fun[k], "'", sep=""), cont=get(x.cont))
x.handl <- paste("h", i, sep="")
assign(x.handl, function(h,...){
eval(parse(text=paste("svalue(sb) <- ", fun[k],
"(svalue(h$obj))", sep="")))
# svalue(sb) <- paste(svalue(h$obj))
})
x.sl <- paste("s", i, sep="")
assign(x.sl, gslider(from=formals(fun[k])$start,
to=formals(fun[k])$end,
by=1, cont=get(x.cont), handler=get(x.handl)))
gseparator(horizontal=FALSE, cont=g, expand=TRUE)
sb <- gstatusbar(paste(fun[k]), cont=w)
}
lapply(1:length(fun) , x.fun)
}
## the two "status bars" will be stacked at the bottom,
## while perfectly I would prefer a "status area" below each slider
count.pop4()
More information about the R-SIG-GUI
mailing list