if(interactive()){
MYFUNC<-function(nh, g)
  {
    print("pressed MYFUNC")
    g$sel
    d  <-  data.frame(list(stations=nh$STNS[g$sel],
                   components=nh$COMPS[g$sel]))
     print(d)        
    g$action  <-  "replot"
    invisible(list(global.vars=g))	
  }
STDLAB <- c("DONE", "QUIT", "SELBUT" , "PSEL", "MYFUNC" )
data(GH)
JJ  <-  swig(GH, sel=1:10, STDLAB=STDLAB)
}
Run the code above in your browser using DataLab