| 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

Optionmenu

The optionmenu iwidget allows selection of one item from a set of items. Only the selected item is displayed, until the user selects the option menu button and a popup menu appears with all the choices available for selection. Once a new item is chosen, the currently selected item is replaced and the popup is removed from the display. Commands exist for manipulating the menu list contents as well. These include the ability to insert, delete, select, disable, enable, and sort items. For further information, see the Optionmenu manpage

Components: hull label menuBtn popupMenu
				

wm title . "Optionmenu Example"

##
##	supporting procedure
##
proc selectProc {} {

	set os [.om get]
	puts "The OS chosen is $os"

	return

}; # end selectProc proc


##=========================================================
##	Create an optionmenu iwidget
##=========================================================
##
iwidgets::optionmenu .om \
	-labeltext "Operating Systems:" \
	-command selectProc

pack .om \
	-padx 10 \
	-pady 10

##
##	Insert items into the list
##
foreach o {SunOS HP/UX AIX OS/2 Windows DOS Linux VMS} {
	.om insert end $o
}

##
##	post configure the menu
##
.om delete 1 2
.om sort ascending
.om select Linux
.om configure \
	-cyclicon true

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