gmenu: Menubar implementation

Description Usage Arguments Value Examples

View source: R/gmenu.R

Description

A menubar for gwindow instances Menu items are specified with a named list. The heirarchical nature of the list maps to the heirarchical menu structure, with the names giving the menu names. The menu actions are specified using gaction elements. These may also be gseperator() instances (no parent necessary here). Menubars should only be added to gwindow instances, but this is not strictly enforced, any Ext.Panel-based container would do.

Usage

1
2
gmenu(menulist, popup = FALSE, action = NULL, container = NULL, ...,
  ext.args = NULL)

Arguments

menulist

list of actions. Actions must have parent specified

popup

Logical. ignored for now

action

Passed to handler to parameterize a call

container

A parent container. In gWidgetsWWW2 a parent container is not optional (though it can be substituted with the parent argument in some circumstances). The parent specifies the widget heirarchy and the ... argument is used to pass along arguments to layout the child component in the parent container. Typically, these are passed to the add method of the parent container.

...

Used to pass along argument to the parent container's add method and possible other arguments to the underlying ference class constructors.

ext.args

The contructors of gWidgetsWWW2 ultimately call an Ext constructor. The options passed to the Ext constructor may be added to or overridden by use of this argument. Values are passed in as named list components and with values converted into JavaScript objects by asJSObject.

Value

an ExtWidget object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
w <- gwindow()
sb <- gstatusbar("Powered by gWidgetsWWW and Rook", cont=w)
stub = function(...) galert("stub", parent=w)
l <- list(
File = list(open=gaction("Open", handler=stub, parent=w),
            new = gaction("New", handler=stub, parent=w),
            gseparator(),
            quit = gaction("Quit", handler=stub, parent=w)),
Edit = list(save = gaction("Save", handler=stub, parent=w))
)
m <- gmenu(l, cont=w)
gtext("Text goes here", cont=w)

gWidgetsWWW2 documentation built on May 2, 2019, 6:10 p.m.