[R-gui] gWidgetsRGtk2: Problem with gradio handler in a proto object

Yvonnick Noel yvonnick.noel at uhb.fr
Fri May 13 08:37:42 CEST 2011


Hello John,

Hope you are doing well.

I note the following problem with the last version of gWidgetsRGtk2. 
Defining a gradio handler as a function embedded in a proto class leads 
to an error :

library(proto)
library(gWidgetsRGtk2)

example = proto(
   create = function(.) {

     .$window = gwindow(visible=FALSE)
     .$choice = gradio(1:3,cont=.$window,handler=.$onChoice)
     visible(.$window)=TRUE
   },
   onChoice = function(.,h,...) {
     cat("You clicked",svalue(.$choice),"\n")
   },
   window = NULL,
   choice = NULL
)

example$create()

Error in as(value, "function") :
   internal problem in as(): "instantiatedProtoMethod" is(object, 
"function") is TRUE, but the metadata asserts that the 'is' relation is 
FALSE

Note that is works if I define the onChoice function outside the proto 
object, and it also works if a replace the gradio by a gdroplist, so it 
seems specific to gradio.

Thank you in advance for your help.

Best wishes,

Yvonnick Noel
University of Brittany, Rennes
France

 > sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=fr_FR.utf8       LC_NUMERIC=C
  [3] LC_TIME=fr_FR.utf8        LC_COLLATE=fr_FR.utf8
  [5] LC_MONETARY=C             LC_MESSAGES=fr_FR.utf8
  [7] LC_PAPER=fr_FR.utf8       LC_NAME=C
  [9] LC_ADDRESS=C              LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] cairoDevice_2.15     gWidgetsRGtk2_0.0-74 gWidgets_0.0-44
[4] proto_0.3-9.2

loaded via a namespace (and not attached):
[1] RGtk2_2.20.12 tools_2.13.0



More information about the R-SIG-GUI mailing list