Posted to tcl by tomk at Tue Mar 10 00:20:59 GMT 2009view pretty

# add a menu bar to the toplevel window
set mbar [MenuBar .]

# define some menus in the menu bar
set definition {
File M {
#   Label               Type    Tag Name(s) 
#   -----------------   ----    ---------
    Exit                C       exit
}
ItemDemo M+ {
#   Label               Type    Tag Name(s) 
#   -----------------   ----    ---------
    "Cut"               C       cut
    "Copy"              C       copy
    "Paste"             C       paste
    --                  S       -
    "Cascade" M:cascade {
        "CheckList" M {
            Apple       X       apple+
            Bread       X       bread
            Coffee      X       coffee
            Donut       X       donut+
            Eggs        X       eggs
            }
        "RadioButtons" M+ {
            "Red"       R       color+
            "Green"     R       color
            "Blue"      R       color
            }
    }
}

ListDemo M {
#   Label               Type    Tag Name(s) 
#   -----------------   ----    ---------
        "Add Item"      C       add_item
        --MORE--        L       items
    }
}

# build the initial set of menus
${mbar} create ${definition}