inst/examples/GtkMenu-2.R

# The popup handler
my_popup_handler <- function(widget, event)
{
  stopifnot(widget != NULL)
  checkPtrType(widget, "GtkMenu")
  stopifnot(event != NULL)

  ## The "widget" is the menu that was supplied when 
  ## gSignalConnect() was called.
  menu <- widget

  if (event[["type"]] == "button-press") {
    if (event[["button"]] == 3) {
      menu$popup(button=event[["button"]], activate.time=event[["time"]])
      return(TRUE)
    }
  }

  return(FALSE)
}

Try the RGtk2 package in your browser

Any scripts or data that you put into this service are public.

RGtk2 documentation built on Oct. 14, 2021, 5:08 p.m.