On Dec 27, 2009, at 11:29 AM, Mark Heckmann wrote:
In The following code, the table handler is executed twice when the
button is pressed (from the 2nd pressing on).
Can't reproduce. On a Mac 10.5.8, R 2.10.1, running the 64 bit GUI,
after choosing the gWidgetstcltk option for GUI toolkit when gwindow()
is first executed, I do not get a behavior that suggests that the
table handler gets executed twice with each button click. I get an X11
window with a button across the width of the top of the window. Each
time the button is clicked I get :
>
addhandlerclicked button
addhandlerclicked table
Just for fun I modified your tbl handler and got sensible incrementing
highlighting of the rows with:
> addhandlerclicked(b, handler=function(h, ...){
+ cat("addhandlerclicked button\n")
+ svalue(tbl, index=T) <- 1+svalue(tbl) # the earlier code did not
change values
+ })
I want it to be executed only once. Does someone know, why this
happens and how I can change it?
library(gWidgets)
w <- gwindow()
b <- gbutton("press", cont=w)
tbl <- gtable(1:10, cont=w)
addhandlerclicked(b, handler=function(h, ...){
cat("addhandlerclicked button\n")
svalue(tbl, index=T) <- 1 # change the table
value
})
addhandlerclicked(tbl, handler=function(h, ...){
cat("addhandlerclicked table\n")
})
Thanks!
Mark
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.