|
Scrolledlistbox
The scrolledlistbox iwidget extends the standard Tk listbox widget with predefined vertical and horizontal scrollbars and an associated label. The set of options available has also been amended to include options which allow specification of the list items. All the usual methods exist, plus new ones for sorting the list contents and a short cut version to acquire the current selection.
For further information, see the Scrolledlistbox
manpage
Components: horizsb hull label listbox vertsb
|
wm title . "Scrolledlistbox Example"
##
## Helper procs for example
##
proc select {} {
puts "Selected Items: [.slb getcurselection]"
return
}; # end proc select
proc dblClick {} {
puts "Double Clicked on [.slb getcurselection]"
return
}; # end proc dblClick
##=========================================================
## Create a scrolledlistbox iwidget
##=========================================================
##
iwidgets::scrolledlistbox .slb \
-hscrollmode dynamic \
-selectioncommand select \
-dblclickcommand dblClick \
-scrollmargin 5 \
-labelpos n \
-visibleitems 28x10 \
-textbackground lightblue \
-selectbackground darkgray \
-selectforeground white \
-labeltext Cities:
pack .slb
.slb insert end Boston Dallas "San Diego" Chicago "New York" Miami Denver Seattle "Los Angeles"
.slb insert end "San Francisco" Minneapolis "Oklahoma City" Phoenix
.slb justify bottom
.slb selection set Seattle
|
Download this sample code |
|