jverzani / gWidgets2

Rewrite of gWidgets
35 stars 9 forks source link

enabled() fails on GCheckboxGroups #82

Closed davidcsterratt closed 9 years ago

davidcsterratt commented 9 years ago

The following code:

library(gWidgets2)
options(guiToolkit="RGtk2")

g.win <- gwindow("Test enabled()")
h.cb <- function(h, ...) {}
g.cb <-  gcheckboxgroup(c("Strain"),
                        checked=c(FALSE),
                        handler=h.cb,
                        container=g.win)
enabled(g.cb) <- FALSE

worked in gWidgets. However in gWidgets2 I get the error:

Error in obj$set_enabled(as.logical(value)) : 
  attempt to apply non-function

I can't see that I'm doing anything wrong from the manual - but perhaps I've missed something?

jverzani commented 9 years ago

That's a bug. The set_enabled function isn't properly defined for this widget. Something like

sapply(g.cb$widgets, function(i) enabled(i) <- FALSE)

Should be a workaround until I get something fixed.

davidcsterratt commented 9 years ago

Thanks for the help. However, this workaround doesn't seem to work for me: the above code doesn't throw an error, but it doesn't disable the checkbox either.

jverzani commented 9 years ago

This is fixed by a76e9b0c01aae5cf884ea145788df5c0fca17ac8 in gWidgets2RGtk2. If you can't install that from devtools, you can use a variant of:

sapply(g.cb$widgets, function(widget) widget$setSensitive(FALSE))

Thanks for letting me know!

davidcsterratt commented 9 years ago

Thanks for this, but I can't see this commit in https://github.com/jverzani/gWidgets2/commits/master . I'm wondering if you need to push your local changes to github?

jverzani commented 9 years ago

The change happened in the toolkit package gWidgetsRGtk2. That is the one that would need updating.

On Tue, May 26, 2015 at 8:52 AM, David C Sterratt notifications@github.com wrote:

Thanks for this, but I can't see this commit in https://github.com/jverzani/gWidgets2/commits/master . I'm wondering if you need to push your local changes to github?

— Reply to this email directly or view it on GitHub https://github.com/jverzani/gWidgets2/issues/82#issuecomment-105515898.

John Verzani Chair, Department of Mathematics College of Staten Island, CUNY verzani@math.csi.cuny.edu