[R-gui] [R Gui]Moving thru fields
James Wettenhall
wettenhall at wehi.edu.au
Fri Apr 23 09:59:42 CEST 2004
Hi,
One thing to add: I think I was making the
list-of-callback-functions stuff too complicated.
This seems to work:
library(tcltk)
tt <- tktoplevel()
f1 <- function()tkmessageBox(message="f1")
f2 <- function()tkmessageBox(message="f2")
functions <- list(f1,f2)
buttons <- list()
for (i in (1:2))
{
buttons[[i]] <- tkbutton(tt,text=paste(i),
command=functions[[i]])
tkpack(buttons[[i]])
}
I guess there's no need to become nervous about when the 'i' is
evaluated in command=functions[[i]]. It appears to be evaluated
when the buttons are defined (as desired), not when the command
is invoked.
Regards,
James
More information about the R-SIG-GUI
mailing list