[R] seMethod for tkpack and tkgrid

Lars Hougaard Hansen BSA lahh at pubhealth.ku.dk
Mon Jan 27 16:20:03 CET 2003


I have a problem, regarding setMethod for "tkpack" and "tkgrid".

Please see attached file.

I am using a Linux-gnu platform and the 1.7.0 version of R.


	Lars Hougaard Hansen
-------------- next part --------------

## problem regarding "setMethod" for "tkpack" and "tkgrid".

library(methods)
library(tcltk)

# a class, "select", is defined, by

setClass("select",representation(listbox="tkwin", listvariable="tclVar"))

# Defining the method "tclvalue" for an object of class "select", by

setMethod("tclvalue","select",
          function(x)
          tclvalue(x at listvariable)
          )

# is accepted as legal R-code. But, when trying to do the same for "tkpack"
# and "tkgrid", R prints an Error.

setMethod("tkpack","select",
          function(x,...)
          tkpack(x at listbox,...)
          )

setMethod("tkgrid","select",
          function(x,...)
          tkgrid(x at listbox,...)
          )

# Error message:
#
# Error in makeGeneric(name, fdef, fdeflt, group = group, valueClass = valueClass,  : 
#	 No suitable arguments to dispatch methods in this function


More information about the R-help mailing list