Documentation‎ > ‎Menus‎ > ‎

    gnocl::menu

    A menu container widget.

    Synopsis

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

    Screenshot

    Options

    -children
    type: list of widget-IDs (default: "")
    List of menu items to be included in the menu.
    -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 sensitive to user input.
    -tearoff
    type: boolean (default: 1)
    Whether the menu can be torn off.
    -title
    type: string (default: "")
    Title of the menu.
    -visible
    type: boolean (default: 1)
    Whether or not the item is visible.

    Description

    A menu is a container widget which is either used in a menubar or as popup to get instantaneous user input.

    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 menu.
    id addBegin list-of-widget-Ids
    Synonym for add.
    id addEnd list-of-widget-Ids
    Add widgets at the end of the menu.
    id popup coordinates
    Display widget as popup menu at specified x,y coordinates.

    Example

    set menu [gnocl::menu \
        -title "menu"]

    $menu add [gnocl::menuItem \
        -text "%#Save" \
        -onClicked {puts "save"}]

    $menu add [gnocl::menuSeparator]

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

    set but1 [gnocl::button -text "CLICKME" -onClicked {$menu popup %x %y} ]

    gnocl::window -child $but1

    Sections