Mark Heckmann
2009-Dec-27 17:59 UTC
[R] gWidgets / RGtk2 - how to change a handler from a toolbar?
I want to assign a default handler to a toolbar button and change the handler later. The addhandlerclicked() method does not apply to a gAction Object, I think... defHandler <- function(h, ...) print("default") w <- gwindow() aTest <- gaction(label="Test", icon="open", handler=defHandler) tblList = list( test = aTest ) toolBar = gtoolbar(tblList, cont=w) At this point I would like to change the handler from the aTest object. Does someone know? TIA Mark ??????????????????????????????????????? Mark Heckmann Dipl. Wirt.-Ing. cand. Psych. Vorstra?e 93 B01 28359 Bremen Blog: www.markheckmann.de R-Blog: http://ryouready.wordpress.com
john verzani
2009-Dec-28 02:19 UTC
[R] gWidgets / RGtk2 - how to change a handler from a toolbar?
Mark Heckmann <mark.heckmann <at> gmx.de> writes:> > > I want to assign a default handler to a toolbar button and change the > handler later. > The addhandlerclicked() method does not apply to a gAction Object, I > think... > > defHandler <- function(h, ...) print("default") > w <- gwindow() > aTest <- gaction(label="Test", icon="open", handler=defHandler) > tblList = list( test = aTest ) > toolBar = gtoolbar(tblList, cont=w) >There should be a method to do this, but for now there isn't. A workaround would be to have the default handler call a function which can be redefined during the flow of the program: f <- function(h,...) print("default") defHandler <- function(h, ...) f(h,...) The RGtk2 way would be to remove the handler and add a new one, but even that isn't so easy, as the id isn't stored at the moment. --John> At this point I would like to change the handler from the aTest object. > Does someone know? > > TIA > Mark > > ??????????????????????????????????????? > Mark Heckmann > Dipl. Wirt.-Ing. cand. Psych. > Vorstra?e 93 B01 > 28359 Bremen > Blog: www.markheckmann.de > R-Blog: http://ryouready.wordpress.com > >