[R] autofill for a tkentry field

Adrian Dragulescu adrian_d at eskimo.com
Mon Jan 1 17:54:26 CET 2007

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")
  tt  <- tktoplevel()
  pw  <- tkframe(tt)
  ppw <- tk2labelframe(pw, text="Fruits:")
  f1  <<- tclVar("")
  entry1.f <- tkentry(ppw, width=30, textvariable=f1, validate="key",

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

Thank you,

More information about the R-help mailing list