In The following code, the table handler is executed twice when the button is pressed (from the 2nd pressing on). 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 ??????????????????????????????????????? Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstra?e 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com
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
Mark Heckmann <mark.heckmann <at> gmx.de> writes:> > In The following code, the table handler is executed twice when the > button is pressed (from the 2nd pressing on). > I want it to be executed only once. Does someone know, why this > happens and how I can change it? > >.. snip ..> Thanks! > Mark >Mark, it is a bug in how svalue<- updates the table, as it does it twice: once to clear the selection and a second time to set the selection. I'll have to look into this one to see what I can do. --John> ??????????????????????????????????????? > Mark Heckmann > Dipl. Wirt.-Ing. cand. Psych. > Vorstra?e 93 B01 > 28359 Bremen > Blog: www.markheckmann.de > R-Blog: http://ryouready.wordpress.com > >
Maybe Matching Threads
- gWidgets / RGtk2 - how to change a handler from a toolbar?
- RGtk2 - retrieve ggraphics mouse coordinates during drag-and-drop event
- How to mimic select.list using RGtk2/gWidgetsRGtk2?
- gWidgets (tcltk): problem extracting values from widgets in glayout grid
- gWidgets process management