jverzani / gWidgets2

Rewrite of gWidgets
35 stars 9 forks source link

gcombobox(..., use_completion=TRUE) and addHandlerKeystroke error #63

Closed landroni closed 10 years ago

landroni commented 10 years ago

Is this error to be expected:

w <- gwindow()
g <- ggroup(cont=w, horizontal=F)
cbb <- gcombobox(letters, editable=T, use_completion=T, cont=g)

Then:

addHandlerKeystroke(cbb, function(h,...){
    if(svalue(cbb)=="asdf"){ 
        cbb$widget$getChildren()[[1]]$modifyBase(GtkStateType["normal"], "red")
        cbb$widget$getChildren()[[1]]$modifyText(GtkStateType["normal"], "white")
    } else {
        cbb$widget$getChildren()[[1]]$modifyBase(GtkStateType["normal"], NULL)
        #cbb$widget$getChildren()[[1]]$modifyText(GtkStateType["normal"], NULL)
    }
})

will result in:

Error in gSignalConnect(widget$getChild(), "keystroke", .$self$key_release_decorator(handler),  : 
                            object '.' not found

The error melts away if I use addHandlerChanged instead.

jverzani commented 10 years ago

Thanks! this was definitely a bug. (As the handler is not on the widget, I don't use the regular code. This one won't return a usable ID for signal blocking. Let me know if that is an issue, as I should be able to work around that.)