[R] use gcheckbox in gWidgets to switch on/off gframe

Rolf Fankhauser rolf.fankhauser at gepdata.ch
Fri Jan 22 11:50:54 CET 2016


Hi Tonja

Maybe I wasn't clear in my last post. This is the code:

library(gWidgetstcltk)
library(gWidgets)
options(guiToolkit="tcltk")
Population <- c("A","B","C","D","E","F")
w = gwindow("")
g1 = ggroup(horizontal = F, cont=w)
g2 = ggroup(horizontal = T, cont=g1)
glabel("Population:", cont=g2)
Station = gcombobox(Population, editable=F, cont=g2, handler=NULL)
gseparator(horizontal=T, container=g1, expand=F)
gcheckbox("checked", checked=T, container=g1, handler=function(h,...) {
enabled ( frame1 ) <- svalue(h$obj)
})
frame1 <- gframe ( "A:" , cont = g1 , horizontal=FALSE )
lyt1 <- glayout ( cont = frame1)
widget_list <- list ( )
lyt1 [1,1] <- "A1:"
lyt1 [1,2,expand = TRUE] <- (widget_list$A1 <- gedit(" ", cont=lyt1, 
handler=NULL))
lyt1 [2,1] <- "A2:"
lyt1 [2,2,expand = TRUE] <- (widget_list$A2 <- gedit(" ", cont=lyt1, 
handler=NULL))
gcheckbox("checked", checked=T, container=g1, handler=function(h,...) {
enabled ( frame2 ) <-  svalue(h$obj)
})
frame2 <- gframe ( "B:" , cont = g1 , horizontal=FALSE )
lyt2 <- glayout ( cont = frame2)
widget_list <- list ( )
lyt2 [1,1] <- "B1:"
lyt2 [1,2, expand = TRUE] <- (widget_list$B1 <- gedit(" ", cont=lyt2, 
handler=NULL))

Regards, Rolf



More information about the R-help mailing list