Documentation‎ > ‎Menus‎ > ‎

gnocl::menuBar

A menu container widget.

Synopsis

gnocl::menuBar [-option value...]

Screenshot

Options

-children
type: list of widget-IDs (default: "")
List of menu items to be included in the menubar.
-name
type: string
Name of the widget, can be used to set options in an rc file.
-sensitive
type: boolean (default: 1)
Whether or not the item is sensitve to user input.
-visible
type: boolean (default: 1)
Whether or not the item is visible.

Description

A gnocl::menubar is a container widget which is used normally at the top of the main window.

Commands

id delete
Deletes the widget and the associated tcl command.
id configure [-option value...]
Configures the widget. Option may have any of the values accepted on creation of the widget.
id add list-of-widget-Ids
Add widgets to the menubar.
id addBegin list-of-widget-Ids
Synonym for add.
id addEnd list-of-widget-Ids
Add widgets at the end of the menubar.

Example

set menuBar [gnocl::menuBar]
set menu [gnocl::menu]

$menu add [gnocl::menuItem \
    -text "%#Quit" \
    -onClicked exit]


$menuBar add [gnocl::menuItem \
    -text "%__File" -submenu $menu]


set menu [gnocl::menu]


$menu add [gnocl::menuItem \
    -text "%__About" \
    -onClicked {puts "About Gnocl"}]


$menuBar add [gnocl::menuItem \
    -text "%__Help" \
    -submenu $menu]


gnocl::window \
    -title "MenuBar" \
    -child $menuBar

results in



Comments