Reputation: 31
I am currently building a GUI based on the R package 'gWidgets2RGtk2'. I want create a button that reacts with a right mouseclick event. Unfortunately, the code below produces a button, but the gmessage is not shown, when right click on the button is performed. Can anybody tell what I am doing wrong?
library("gWidgets2")
library("RGtk2")
library("gWidgets2RGtk2")
options("guiToolkit"="RGtk2")
#
w <- gwindow("main_window_header")
B <- gbutton("?", container = w)
addHandlerRightclick(B, handler = function(h, ...){gmessage("It worked!")})
Using the line
addHandlerDoubleclick(B, handler = function(h, ...){gmessage("It worked!")})
instead of
addHandlerRightclick(B, handler = function(h, ...){gmessage("It worked!")})
is not showing the gmessage when double-clicking the button. However,
addHandler(B, signal = "clicked", handler = function(h, ...){gmessage("It worked!")})
is working perfectly. What am I missing?
Upvotes: 1
Views: 114
Reputation: 31
I found a solution. Apparently package "gWidgets" is needed for the right mouseclick handler. Adding
library("gWidgets")
to the header makes the example work for addHandlerRightclick.
Upvotes: 1