Question

I'm make GUI with a pop up menu with right click, over a graphic but at the same time appear a pop up menu with the options copy or save graphics, how i can delete this last pop up menu?

 library(cairoDevice)
 library(ggplot2)
 library(gWidgets)
 library(gWidgetsRGtk2)
 require(RGtk2)

  plot1<-ggplot(mtcars, aes(wt, mpg))+ geom_point(colour = "black", size = 3)
  plot2<-ggplot(mtcars, aes(wt, mpg))+geom_point(colour = "red", size = 3)
  plot3<- ggplot(mtcars, aes(wt, mpg))+ geom_point(colour = "yellow", size = 3,shape=20)

  options(guiToolkit = "RGtk2")
  w        <-gwindow("GUI")
  g        <-ggroup(cont=w)
 graphic1 <- ggraphics(cont=g)
 print(plot1)

 ml<-list()
 ml$plot2<- list(handler=function(h,...){
  svalue(graphic1)<- print(plot2)
  })
 ml$plot3<- list(handler=function(h,...){
 svalue(graphic1)<-print(plot3)
 })

 add3rdMousePopupmenu(obj=graphic1,menulist=ml,action=graphic1)`
Was it helpful?

Solution

There are some hidden arguments for ggraphics under RGtk2. Try passing no_popup=TRUE to the ggraphics constructor. If you want to remove rubber banding, the argument to pass is do.rubber.banding=FALSE (why . for one, _ for the other? don't ask...)

OTHER TIPS

Look,

w <- gwindow("notebook example")
nb <- gnotebook(cont=w)

devs <- lapply(1:5, function(i) ggraphics(cont=nb,no_popup=T, label=as.character(i)))

addHandlerChanged(nb, handler=function(h,...) {
gg <- h$obj[h$pageno]
visible(gg) <- TRUE
})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top