Hello all,
I'm experimenting with tlk/tk and I find it very useful. I would like to
have the text of a tkentry be automatically filled when the user starts
typing, according to a  predetermined list.  I've found a solution on the
tcl wiki pages, but I don't quite know how to translate it in R... Here is
the tcl code: http://wiki.tcl.tk/13267
And here is my code that does not work.
 autofill <- function(){
    cat("I was here!")
    entry <- tclvalue(f1)
    ind <- grep(entry, fruitList)
    if (length(ind)>0){f1 <- tclVar(fruitList[ind[1]])}
   }
  fruitList <<- c("Apple", "Banana",
"Peach", "Pear", "Plum", "Mango")
  tkdestroy(tt)
  tt  <- tktoplevel()
  pw  <- tkframe(tt)
  ppw <- tk2labelframe(pw, text="Fruits:")
  f1  <<- tclVar("")
  entry1.f <- tkentry(ppw, width=30, textvariable=f1,
validate="key",
                      validatecommand=autofill)
  tkgrid(entry1.f)
  tkgrid(ppw)
  tkgrid(pw)
I don't know how to pass arguments to the autofill function, so I can
manipulate the textvariable.  Any help is much appreciated.  If we get a
working solution, maybe we should add this example to
http://www.sciviews.org/_rgui/tcltk/index.html.
Thank you,
Adrian