I've been trying to get his to work all day, but I can't find a simple explanation on how this works. I have a vector with 3 items, c(file1, file2, file3)
, I want to be able to toggle the checkbox on and off, when its on I want the first item c(file1)
to be in the vector, however when its off I want it to be deleted from the vector. This is my attempt at it, but I don't know why its not working:
library(gWidgetRGtk2)
GraphFiles <- FileNamesOrig
w <- gwindow("Tag Density Checkboxes")
g <- ggroup(container = w)
lyt <- glayout(cont = g, horizontal = T)
gcheckbox(FileNamesOrig[1], container=g, checked=TRUE, handler=function(h,...){
if(!svalue(h$obj)){GraphFiles[[1]] <- NA} else {GraphFiles[[1]] <-FileNamesOrig[1]}
})
While we're all here, I was thinking of doing:
for(i in 1:No.file)
gcheckbox(GraphFiles[i], container=g, handler=function(h,...){
})
No.file = 3
First, how would I get the check-boxes on a separate line within the GUI window. And second how would I incorporate the functionality of the first piece of code into the loop? (the problem is the number of input will differ each run of the script)