[R] MENU TCL-TK

ermimi ermimi_ at hotmail.com
Tue Mar 18 20:23:40 CET 2008


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-tp16128790p16128790.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list