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

  1. # add a menu bar to the toplevel window
  2. set mbar [MenuBar .]
  3.  
  4. # define some menus in the menu bar
  5. set definition {
  6. File M {
  7. # Label Type Tag Name(s)
  8. # ----------------- ---- ---------
  9. Exit C exit
  10. }
  11. ItemDemo M+ {
  12. # Label Type Tag Name(s)
  13. # ----------------- ---- ---------
  14. "Cut" C cut
  15. "Copy" C copy
  16. "Paste" C paste
  17. -- S -
  18. "Cascade" M:cascade {
  19. "CheckList" M {
  20. Apple X apple+
  21. Bread X bread
  22. Coffee X coffee
  23. Donut X donut+
  24. Eggs X eggs
  25. }
  26. "RadioButtons" M+ {
  27. "Red" R color+
  28. "Green" R color
  29. "Blue" R color
  30. }
  31. }
  32. }
  33.  
  34. ListDemo M {
  35. # Label Type Tag Name(s)
  36. # ----------------- ---- ---------
  37. "Add Item" C add_item
  38. --MORE-- L items
  39. }
  40. }
  41.  
  42. # build the initial set of menus
  43. ${mbar} create ${definition}