| Itcl  | Itk  | Itcl @ Wiki  | Itcl @ SF  | Tcl  | Tcl @ Wiki |
  home || iwidgets || man pages cross ref distribution docs faq  
buttonbox
calendar
canvasprintbox
canvasprintdialog
checkbox
combobox
dateentry
datefield
dialog
dialogshell
disjointlistbox
entryfield
extbutton
extfileselectionbox
extfileselectiondialog
feedback
fileselectionbox
fileselectiondialog
finddialog
hierarchy
hyperhelp
labeledframe
labeledwidget
mainwindow
menubar
messagebox
messagedialog
notebook
optionmenu
panedwindow
promptdialog
pushbutton
radiobox
regexpfield
scrolledcanvas
scrolledframe
scrolledhtml
scrolledlistbox
scrolledtext
scrolledwidget
selectionbox
selectiondialog
shell
spindate
spinint
spinner
spintime
tabnotebook
tabset
timeentry
timefield
toolbar
watch

man page | options | methods

Menubar

The menubar iwidget provides an easy way to build a menu. Menubuttons and cascading menus can be added using the add public method, and by also using the -menubuttons option. It also provides for a help variable that can be used to display help information for a menu item, in a label. For example, the programmer would just associate the -textvariable for a label with the help variable that was given for the menu. The iwidget has many public methods that are used to create, manipulate, and delete menus, and menu items. The menucget and menuconfigure public methods are used to query, and modify an individual menubutton. One other sutle feature of the Menubar is that if one of the menubar menubutton is named \"help\", then the iwidget will automatically place that menubutton on the ride side of the menubar, since typically, this is where the help menu will be. For further information, see the Menubar manpage

Components: hull menubar
				

wm title . "Menubar Example"

##=========================================================
##	Creata a Menubar iwidget
##
##	Add some menubuttons using the
##	-menubuttons option
##=========================================================
##
iwidgets::menubar .mb \
  -helpvariable helpVar \
  -menubuttons {
    menubutton file \
      -text "File" \
      -menu {
        command new \
          -label "New" \
          -command {puts "New Menu"}
        command open \
          -label "Open" \
          -command {puts "Open Menu"}
        command save \
          -label "Save" \
          -command {puts "Save Menu"}
        command exit \
          -label "Exit" \
          -command {puts "Exit Menu"}
      }; # end menu for file menubutton

    menubutton options \
      -text "Options" \
      -menu {
        cascade color \
          -label "Color" \
          -menu {
            radiobutton black \
              -label "Black"
            radiobutton white \
              -label "White"
            radiobutton blue \
              -label "Blue"
          }
        command font \
          -label "Font" \
          -command {puts "Font Menu"}
    }; # end menu for options menubutton

  }; # end -menubttons option

##
##	Try adding some menubuttons via the 
##	add public method
##
.mb add menubutton help \
  -text Help \
  -menu {
    command helpbrowser \
    -label "Help Browser" \
    -command {puts "Help Browser"}

    command about \
    -label "About" \
    -command {puts "About"}
  }


##
##	Create a scrolledtext so for illustration
##	purposes
##
iwidgets::scrolledtext .st \
  -hscrollmode static \
  -vscrollmode static \
  -textbackground black \
  -foreground green

.st import [file join / usr local tcl8.3.3 README]

##
##	Create a label to illustrate the help variable
##
label .lb \
  -textvariable helpVar

pack .mb .st .lb \
  -fill both \
  -expand 1

Download this sample code
man page | options | methods
 
  home || iwidgets || man pages cross ref distribution docs faq  
Copyright | Contributions | Development Team | Credits
Bugs/Comments/Suggestions about this web site