[R] Need suggestions about GUI

Felix Andrews felix at nfrac.org
Thu Jan 24 03:12:00 CET 2008


> 3, In the coding buttong, how can I avoid using <<- in handler function.

coding <- gbutton("      Coding      ",container=codepanel,
    action=environment(), handler=function(h, ...) {
        env <- h$action
        ## blah blah
        env$node[n_coding] <- svalue(addcode)
    })

but make sure that the button is created in the same environment that
you want to set the variables in!

-Felix


On Jan 22, 2008 11:41 PM, ronggui <ronggui.huang at gmail.com> wrote:

> coding <- gbutton("      Coding      ",container=codepanel,handler=
> function(...){
> if (svalue(addcode)!="" && sel!=""){
> sel <<- paste(getsel(ed),collapse="\n")
> sel_index <<- get_index(ed)
> n_coding <<- n_coding + 1
> node[n_coding] <<- svalue(addcode)
> chunk[n_coding] <<- sel
> begin[n_coding] <<- sel_index[1]
> end[n_coding] <<- sel_index[2]
> }}
> )


-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8



More information about the R-help mailing list