On 2/27/10, j verzani <jverz...@gmail.com> wrote: > Sorry, not without just using RGtk2 commands. At some time this was possible, > but I changed the behavior so statusbars, menusbars and toolbars are only > part > of a toplevel window. > Any chance that this would be relaxed in future versions?
> If you want to use RGtk2 commands, it isn't so hard. Here is an example: > I've been comparing RGtk2 and tcltk, and sofar I prefer tcltk behaviour. The complaints are mainly petty, but they can impact productivity (see the code at the end): - tcltk resizes the window/containers dynamically, to fit any additional elements; RGtk2 creates a window of fixed size (much bigger than the containing widgets). - for the sliders, when clicking on a slider's "empty space", RGtk2 will switch the sliders value to either min or max, while tcltk will change it by a step of 1. - for the sliders, tcltk doesn't react to the mouse scroll-wheel, while RGtk2 does. However, RGtk2 will change the values using a step of 2 (say, from 1 -> 3 -> 5; even though `by=1') instead of a preferable step of 1 (from 1 -> 2 -> 3). In any case, I've just tried gspinbutton() instead of gslider(), and I get much of what I need. Also, using pure RGtk2 commands I have the statusbars as I wanted, so I guess I'll stick with RGtk2. Thanks for the suggestions Liviu ##prepare the sliders count.mv.int <- function(x, start=1, end=4){ 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=7){ assign("l", letters[x], envir = .GlobalEnv) print(paste("l = ", l)) return(paste("l = ", l)) } count.mv.let(3); l ##generate the GUI count.pop4 <- function(fun=c("count.mv.int", "count.mv.let"), kit=c("RGtk2", "tcltk"), sb=T){ require(gWidgets) options(guiToolkit=kit[1]) w <- gwindow(paste("Counters (lapply)")) g <- ggroup(cont=w, horizontal=T) x.fun <- function(k){ x.cont <- paste("g", k, sep="") assign(x.cont, ggroup(cont=g, horizontal=FALSE)) glabel(paste("'", fun[k], "'", sep=""), cont=get(x.cont)) x.handl <- paste("h", k, sep="") assign(x.handl, function(h,...){ x.mess <- eval(parse(text=paste(fun[k], "(svalue(h$obj))", sep=""))) get(x.sb)$push(1, x.mess) }) x.sl <- paste("s", k, 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) if(sb){ x.sb <- paste("s", k, sep="") assign(x.sb, gtkStatusbar()) add(get(x.cont), get(x.sb)) get(x.sb)$push(1, fun[k]) } } lapply(1:length(fun) , x.fun) } ##RGtk2 exp count.pop4() ##tcltk exp count.pop4(kit="tcltk", sb=F) > sessionInfo() R version 2.10.1 (2009-12-14) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] tcltk stats graphics grDevices utils datasets methods [8] base other attached packages: [1] gWidgetsRGtk2_0.0-59 gWidgetstcltk_0.0-30 gWidgets_0.0-39 [4] fortunes_1.3-7 RGtk2_2.12.18 cairoDevice_2.10 [7] sos_1.2-5 brew_1.0-3 hints_1.0.1-1 loaded via a namespace (and not attached): [1] tools_2.10.1 _______________________________________________ R-SIG-GUI mailing list R-SIG-GUI@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui