Learn R Programming

gWidgets2 (version 1.0-9)

gmenu: menu constructor, main and popup

Description

A menu may be viewed as a heirarchical collection of buttons, each invoked by clicking on the button. These buttons are exposed through submenus. More generally, a widget may replace the button. This widget intends to support buttons (gactions), separators (gseparator), radio button (gradio) and checkbutton (gcheckbox), but this may be toolkit independent. When using a radio button or checkbox, one should pass in a parent argument to the constructor -- not a container.

For a menubar, svalue returns the list of action items etc. that defined the menubar. This can be useful to access the underlying item being proxied. (For gaction items the enabled<- method may be used on the item, but this may not extend to gradio and gcheckbox items)

for a menubar, svalue<- replaces the menubar items with new ones specified by value.

Usage

gmenu(menu.list, popup = FALSE, container = NULL, ..., toolkit = guiToolkit())

.gmenu(toolkit, menu.list = list(), popup = FALSE, container = NULL, ...)

# S3 method for GMenuBar add(obj, child, expand = FALSE, fill = NULL, anchor = NULL, ...)

# S3 method for GMenuBar svalue(obj, index = NULL, drop = NULL, ...)

# S3 method for GMenuBar svalue (obj, index=NULL, ...) <- value

Arguments

menu.list

A list defining the menu structure. Named sub lists determine the submenu titles and structure. The list may have components of class: GAction, mapped to a button; GSeparator, mapped to a horizontal separator; GRadio, mapped to linked buttons; or GCheckbox, mapped to a checkbox button.

popup

logical. If true, make a popup window to be added through a handler call

container

A parent container. When a widget is created it can be incorporated into the widget heirarchy by passing in a parent container at construction time. (For some toolkits this is not optional, e.g. gWidgets2tcltk or gWidgets2WWW2.)

...

These values are passed to the add method of the parent container. Examples of values are expand, fill, and anchor, although they're not always supported by a given widget. For more details see add. Occasionally the variable arguments feature has been used to sneak in hidden arguments to toolkit implementations. For example, when using a widget as a menubar object one can specify a parent argument to pass in parent information, similar to how the argument is used with gaction and the dialogs.

toolkit

Each widget constructor is passed in the toolkit it will use. This is typically done using the default, which will lookup the toolkit through guiToolkit.

obj

parent object

child

list. a menubar list or gmenu instance.

expand

NULL or logical. For box containers controls whether a child will expand to fill the allocated space.

fill

NULL or character. For box containers. The value of fill (not always respected) is used to control if expansion happens vertically (y), horizontally (x) or both (both or TRUE). For vertically filled box containers, children always fill horizontally (atleast) and for horizontally filled box containers, children always fill vertically (atleast). This is important to realize when trying to size buttons, say.

anchor

NULL or integer. For box containers. The anchor argument is used to position the child within the parent when there is more space allocated than the child requests. This is specified with a Cartesian pair in -1,0,1 x -1, 0, 1.

index

ignored

drop

ignored

value

a list or menu bar specifying the new men ubar