Hello all, I´d like a tk2menubutton to display a menu when clicking the 'arrow' and to trigger a function when clicking the text.
I have the following: require(tcltk2) widgetPrincipal <- tktoplevel() tipo.busqueda.valores <- tclVar('Single-Query') tipo.busqueda.boton <- tk2menubutton(widgetPrincipal, textvariable = tipo.busqueda.valores, width = 15 ) tipo.busqueda.menu <- tk2menu(tipo.busqueda.boton, tearoff = FALSE) tkadd( tipo.busqueda.menu, 'command' , label = 'Tesauro', command = function() {tclvalue(tipo.busqueda.valores )<<- 'Tesauro'}) tkadd( tipo.busqueda.menu, 'command' , label = 'Single-Query', command = function() {tclvalue(tipo.busqueda.valores )<<- 'Single-Query'}) tkconfigure(tipo.busqueda.boton, menu = tipo.busqueda.menu) tkpack(tipo.busqueda.boton) # this being the function I would like to trigger tipo.busqueda.accion = function(){ if (as.character(tclvalue(tipo.busqueda.valores)) == 'Tesauro') { # do A }else{ # do B } } Any tips. Thanks [[alternative HTML version deleted]]
_______________________________________________ R-SIG-GUI mailing list R-SIG-GUI@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui