> 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 <[EMAIL PROTECTED]> 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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to