**menubar 1.0 - Create and manipulate a menubar** Creates an instance of the ''menubar'' Class. ---- ***Screen shot of cascade menus*** [menubar ScreenShot1] ***Screen shot of dynamic menu extension*** [menubar ScreenShot2] ---- ***SYNOPSIS*** ****package require ''Tcl 8.6''**** ****package require ''Tk 8.6''**** ****package require ''menubar ?1.0?''**** * '''menubar new''' ?options? * ''mBarInst'' '''define''' ''body'' * ''mBarInst'' '''install''' ''pathName body'' * ''mBarInst'' '''menu.configure''' ''option tag-settings ?option tag-settings ...?'' * ''mBarInst'' '''menu.namespace''' ''tag namespace'' * ''mBarInst'' '''menu.show''' ''tag'' * ''mBarInst'' '''menu.hide''' ''tag'' * ''mBarInst'' '''tag.add''' ''tag value'' * ''mBarInst'' '''tag.configure''' ''pathName tag ?option value ...option value?'' * ''mBarInst'' '''tag.cget''' ''pathName tag ?option?'' * ''mBarInst'' '''group.add''' ''tag label ?cmd? ?accel? ?sequence? ?state?'' * ''mBarInst'' '''group.delete''' ''tag label'' * ''mBarInst'' '''group.move''' ''direction tag label'' * ''mBarInst'' '''group.configure''' ''tag label ?option value ...option value?'' * ''mBarInst'' '''group.serialize''' ''tag'' * ''mBarInst'' '''group.deserialize''' ''tag stream'' * ''mBarInst'' '''debug''' ''{ tree | nodes | installs }'' ---- ***DESCRIPTION*** '''menubar new''' ?options?: Create and return a new instance of the menubar class. The menubar class encapsulates the definition, installation and dynamic behavior of a menubar. The class doesn't depend on a widget framework and therefore can be used with or without a framework (e.g. Bwidget, IWidget, Snit, etc.). Unlike other Tk widget commands, the menubar command doesn't have a ''pathName'' argument because menubars are handled by the display manager and not the application. ---- ***STANDARD OPTIONS*** The following standard options can be used when creating a menubar instance. The effect of these options is platform specific. http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-activebackground%|%-activebackground%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-activeborderwidth%|%-activeborderwidth%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-activeforeground%|%-activeforeground%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-background%|%-background%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-borderwidth%|%-borderwidth%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-cursor%|%-cursor%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-disabledforeground%|%-disabledforeground%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-font%|%-font%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-foreground%|%-foreground%|% http://docs.activestate.com/activetcl/8.5/tcl/TkCmd/options.htm#M-relief%|%-relief%|% ---- ***INTRODUCTION*** An instance of the menubar class provides methods for compiling a description of the menubar, configuring menu items and installing the menubar in toplevel windows. A menubar can be thought of as a tree of cascading menus. Users define a menubar using a language that results in a human readable description of a menubar. The description of the menubar is then compiled by an instance of the menubar class after which it can be installed in one or more toplevel windows. By default a menubar instance is kept synchronized in all toplevel windows where it is installed. This means the state of radiobuttons, checkboxs, etc. are the same for all installed toplevel windows. The menubar class provides many unique capabilities that are not found in other tcl/tk menubar implementation. Some of these are: * A tagging system that simplifies access to menu entries in the menu tree. * Automatic management of state variables for checkbuttons and radiobuttons. * Namespace support for all callback commands so callback commands can be easily grouped into namespaces. * Support for menubar synchronization across multiple toplevel windows. * A simplified and uniform interface for all callback commands. * A simplified method for creating radiobutton groups. * Support for hiding and exposing menus on the menubar. * Support for user defined tags that depend on the toplevel window context. * Management of tear-off menus. * Support for menu extension with user defined menu entries. * Support for saving and restoring user defined menu entries. ---- ***TERMINOLOGY*** MENUBAR: The visible rendering of a menubar in a toplevel window is a horizontally group of cascading Tk menus. MENU: A menu is an ordered list of items that is rendered vertically. Menus are not visible until a user preforms some action (normally a event). A menu may contain any number of child menus that are rendered as cascading menus. Cascading menus are rendered next to the parent menu when they are activated. MENU ENTRY: A menu contains an ordered list of items called entries. Menu entries have a type and the menubar class supports the following 6 entry types: ''Command'', ''Checkbutton'', ''Radiobutton'', ''Separator'', ''Group'' and ''Menu''. ENTRY LABEL: Each menu entry has a visible string that is called the entry label. TAG: A tag is name that is normally used to refer to an item in a menu tree. A tag name is an alphanumeric character string that may include the underscore character. Menu tree tags are defined for all nodes and leafs in a menu tree. This provides a flat abstraction of the tree and simplifies item referencing in menubar methods. Without this abstraction it would be necessary to reference menu elements using a tree path which could change at run-time. The menubar class also has a method that can create a user defined tag. User defined tags store values that change based on the currently active toplevel window. User defined tags can be used to store widget pathnames use by callback code so that output can be routed to the appropriate toplevel window. ---- ***METHODS*** ''mBarInst'' '''define''' ''body'': Compiles ''body'' into a tree of menu entries which define the visual layout of the menubar. The ''body'' argument describes the layout using the following syntax, where the elements of the syntax are described below. ====== body == definitions definitions ::= { | | } ignore ::= { | | # } definition ::= { | | | | | } command ::=