Node:menubutton, Next:, Previous:menu, Up:Widget Creation


A menubutton widget displays like a button, but when activated a menu pops up. The menu of the menubutton is defined through the menu command and is attached to the menubutton. An example of a menu button:

menubutton .mb -menu .mb.m -text "mymenu"
menu .mb.m
.mb.m add command -label hello
.mb.m add command -label goodbye

which crates a menubutton widget named .mb with attached menu .mb.m and displays the text mymenu. Menu .mb.m is defined as two command options, one labelled hello and the other labelled goodbye. When the menubutton .mb is clicked on then the menu .mb.m will popup and its options can be chosen.