Re: [R] MENU TCL-TK

From: ermimi <ermimi__at_hotmail.com>
Date: Tue, 18 Mar 2008 14:25:58 -0700 (PDT)

        

My doubts were resolved, thank you Gabor!!!!

ermimi wrote:
>
> Hello!
>
> I need help in a menu in TCL-TK. I have 3 functions, one function
> (function1) that sum 2 numbers and return the result. Other
> function(function2) that print a number. And the other (function3), is a
> menu that has several options. I need use the result that returns the
> option that calls to function1 to call the function2.
>
> tkadd(openRecentMenu,"command",label="Function1",
> command=function() function1(a,b))
>
>
> tkadd(openRecentMenu,"command",label="Function2",
> command=function() function2(d))
>
> I want that the value "d" is the return value of the function1, but I
> donĀ“t know as I can asign the value to "d"
>
> Next, I show the 3 functions.
>
> Thank you very much,
>
> A greetings
>
> function1<-function(a,b){
> return(a+b);
> }
>
> function2<-function(a){
> print(a);
> }
>
> function3<-function(a,b){
> require(tcltk)
> tt <- tktoplevel()
> topMenu <- tkmenu(tt)
> tkconfigure(tt,menu=topMenu)
> fileMenu <- tkmenu(topMenu,tearoff=FALSE)
> openRecentMenu <- tkmenu(topMenu,tearoff=FALSE)
> tkadd(openRecentMenu,"command",label="Function1",
> command=function() function1(a,b))
> tkadd(openRecentMenu,"command",label="Function2",
> command=function() function2(d))
> tkadd(fileMenu,"cascade",label="Functions",menu=openRecentMenu)
> tkadd(fileMenu,"command",label="Quit",command=function() tkdestroy(tt))
> tkadd(topMenu,"cascade",label="File",menu=fileMenu)
> tkfocus(tt)
> }
>

-- 
View this message in context: http://www.nabble.com/MENU-TCL-TK-tp16128790p16131042.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_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.
Received on Tue 18 Mar 2008 - 21:29:36 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 18 Mar 2008 - 21:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive