menubar - Create and manipulate menubar menu widgets

SYNOPSIS

menubar pathName ?options?

INHERITANCE

itk::Widget <- menubar

STANDARD OPTIONS

activeBackground
activeBorderWidth
activeForeground
anchor
foreground
borderWidth
cursor
disabledForeground
font
padX
highlightBackground
highligthThickness
highlightColor
justify
padY
relief
wrapLength
background

See the "options" manual entry for details on the standard options.

WIDGET-SPECIFIC OPTIONS

Name:                   helpVariable
Class:                  HelpVariable
Command-Line Switch:	-helpvariable

Name:                   menuButtons
Class:                  MenuButtons
Command-Line Switch:	-menubuttons

    -menubuttons
    -text
    -text
    -text

{
File
Edit
Options
menubar
menubutton
menubutton
menubutton
}
.mb
file
edit
options

DESCRIPTION

The menubar command creates a new window (given by the pathName argument) and makes it into a menubar menu widget. Additional options, described above may be specified on the command line or in the option database to configure aspects of the menubar such as its colors and font. The menubar command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

A menubar is a widget that simplifies the task of creating menu hierarchies. It encapsulates a frame widget, as well as menubuttons, menus, and menu entries. The menubar allows menus to be specified and referenced in a more consistent manner than using Tk to build menus directly. Menubar allows a menu tree to be expressed in a hierachical "language". The menubar accepts a menuButtons option that allows a list of menubuttons to be added to the menubar. In turn, each menubutton accepts a menu option that specifies a list of menu entries to be added to the menubutton's menu. Cascade entries also accept the menu option for specifying a list of menu entries to be added to the cascade's menu. Additionally, the menubar allows each component of the menubar system to be referenced by a simple menuPathName syntax. The menubar also extends the set of options for menu entries to include a helpStr option.

MENU PATH NAMES

A menuPathName is a series of component names separated by the `.' character. Each menubar component can be referenced via these menuPathNames. menuPathNames are similar to widget pathNames in Tk. Some correspond directly to a widget pathName (components of type menu or menubutton), others correspond to a menu entry type. Every widget and entry in a menubar can be referenced with the menuPathName naming convention. A menubar can have four types of components:

The suffix of a menuPathName may have the form of:

tkWidgetName
Specifies the name of the component, either a frame, menubutton, menu, or an entry. This is the normal naming of widgets. For example, .file references a menubutton named file.

The menuPathName is a series of segment names, each separated by the '.' character. Segment names may be one of the following forms:

number
Specifies the index of the the component. For menubuttons, 0 corresponds to the left-most menubutton of the menu bar frame. As an example, .1 would correspond to the second menubutton on the menu bar frame.
end
Specifes the last component. For menubuttons, it specifies the right-most entry of the menu bar frame. For menu entries, it specifies the bottom-most entry of the menu.
last
Same as end.

Finally, menu components always end with the menu keyword. These components are automatically created via the -menu option on menubuttons and cascades or via the add or insert commands.

menu
Specifes the menu pane that is associated with the given menubutton prefix. For example, .file.menu specifies the menu pane attached to the .file menubutton.

For example, the path .file.new specifies the entry named new on the menu associated with the file menubutton located on the menu bar. The path .file.menu specifies the menu pane associated with the menubutton .file. The path .last specifies the last menu on the menu bar. The path .0.last would specify the first menu (file) and the last entry on that menu (quit), yielding .file.quit. As a restriction, the last name segment of menuPathName cannot be one of the keywords last, menu, end, nor may it be a numeric value (integer).

WIDGET-SPECIFIC METHODS

The menubar command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

pathName option ?arg arg ...?
option and the args determine the exact behavior of the command.

In addition, many of the widget commands for menubar take as one argument a path name to a menu component. These path names are called menuPathNames. See the discussion on MENUBAR PATH NAMES above.

The following commands are possible for menubar widgets:

pathName add type menuPathName ?option value option value?
Adds either a menu to the menu bar or a menu entry to a menu pane.
pathName cget option
Returns the current value of the configuration option given by option.
pathName configure ?options value option value?