NAME
iwidgets::scrolledlistbox - Create and manipulate scrolled listbox wid-
getsSYNOPSIS
iiwwiiddggeettss::::ssccrroolllleeddlliissttbbooxx pathName ?options? IINNHHEERRIITTAANNCCEEitk::Widget <- iwidgets::Labeledwidget <- iwidgets::Scrolledwidget <-
iwidgets::Scrolledlistbox SSTTAANNDDAARRDD OOPPTTIIOONNSS aaccttiivveeBBaacckkggrroouunndd bbaacckkggrroouunndd bboorrddeerrWWiiddtthh ccuurrssoorr eexxppoorrttSSeelleeccttiioonn ffoorreeggrroouunndd hhiigghhlliigghhttCCoolloorr hhiigghhlliigghhttTThhiicckknneessss rreelliieeff sseelleeccttBBaacckkggrroouunndd sseelleeccttBBoorrddeerrWWiiddtthh sseelleeccttFFoorreeggrroouunndd See the "options" manual entry for details on the standard options. AASSSSOOCCIIAATTEEDD OOPPTTIIOONNSS sseelleeccttMMooddee lliissttvvaarriiaabblleeSee the "listbox" widget manual entry for details on the above associ-
ated options. aaccttiivveeRReelliieeff eelleemmeennttBBoorrddeerrwwiiddtthh jjuummppttrroouugghhCCoolloorrSee the "scrollbar" widget manual entry for details on the above asso-
ciated options. IINNHHEERRIITTEEDD OOPPTTIIOONNSS ddiissaabblleeddFFoorreeggrroouunndd llaabbeellBBiittmmaapp llaabbeellFFoonnttllaabbeellIImmaaggee llaabbeellMMaarrggiinn llaabbeellPPooss llaabbeellTTeexxtt llaabbeellVVaarriiaabbllee ssttaattee ssttiicckkyy See the "labeledwidget" class manual entry for details on the inherited options.WWIIDDGGEETT-SSPPEECCIIFFIICC OOPPTTIIOONNSS
Name: ddbbllCClliicckkCCoommmmaanndd Class: CCoommmmaannddCommand-Line Switch: -ddbbllcclliicckkccoommmmaanndd
Specifies a Tcl command procedure which is called when an item is double clicked. Typically this occurs when mouse button 1 is double clicked over an item. Selection policy does not matter. Name: hheeiigghhtt Class: HHeeiigghhttCommand-Line Switch: -hheeiigghhtt
Specifies the height of the scrolled list box as an entire unit. The value may be specified in any of the forms acceptable to TTkkGGeettPPiixxeellss. Any additional space needed to display the other components such as labels, margins, and scrollbars force the listbox to be compressed. A value of zero along with the same value for the width causes the value given for the visibleitems option to be applied which administers geometry constraints in a different manner. The default height is zero. Name: hhssccrroollllMMooddee Class: SSccrroollllMMooddeeCommand-Line Switch: -hhssccrroollllmmooddee
Specifies the the display mode to be used for the horizontal scrollbar: ssttaattiicc,, ddyynnaammiicc,, or nnoonnee. In static mode, the scroll bar is displayed at all times. Dynamic mode displays the scroll bar as required, and none disables the scroll bar display. The default is static. Name: ssbbWWiiddtthh Class: WWiiddtthhCommand-Line Switch: -ssbbwwiiddtthh
Specifies the width of the scrollbar in any of the forms accept-
able to TTkkGGeettPPiixxeellss. The default width is 15 pixels.. Name: ssccrroollllMMaarrggiinn Class: MMaarrggiinnCommand-Line Switch: -ssccrroollllmmaarrggiinn
Specifies the distance between the listbox and scrollbar in anyof the forms acceptable to TTkkGGeettPPiixxeellss. The default is 3 pix-
els. Name: sseelleeccttiioonnCCoommmmaanndd Class: CCoommmmaannddCommand-Line Switch: -sseelleeccttiioonnccoommmmaanndd
Specifies a Tcl command procedure which is called when an item is selected. Selection policy does not matter. Name: ssttaattee Class: SSttaatteeCommand-Line Switch: -ssttaattee
Specifies one of two states for the listbox: nnoorrmmaall or ddiissaabblleedd. If the listbox is disabled then selection is ignored. The default is normal. Name: tteexxttBBaacckkggrroouunndd Class: BBaacckkggrroouunnddCommand-Line Switch -tteexxttbbaacckkggrroouunndd
Specifies the background color for the listbox. This allows the background within the listbox to be different from the normal background color. Name: tteexxttFFoonntt Class: FFoonnttCommand-Line Switch: -tteexxttffoonntt
Specifies the font to be used for text in the listbox. This allows for the font associated with text internal to the scrolled listbox to be different than the font for labels. Name: vviissiibblleeiitteemmss Class: VViissiibblleeIItteemmssCommand-Line Switch: -vviissiibblleeiitteemmss
Specifies the widthxheight in characters and lines for the list-
box. This option is only administered if the width and height options are both set to zero, otherwise they take precedence. The default value is 20x10. With the visibleitems optionengaged, geometry constraints are maintained only on the list-
box. The size of the other components such as labels, margins, and scroll bars, are additive and independent, effecting the overall size of the scrolled list box. In contrast, should the width and height options have non zero values, they are applied to the scrolled list box as a whole. The listbox is compressed or expanded to maintain the geometry constraints. Name: vvssccrroollllMMooddee Class: SSccrroollllMMooddeeCommand-Line Switch: -vvssccrroollllmmooddee
Specifies the the display mode to be used for the vertical scrollbar: ssttaattiicc,, ddyynnaammiicc,, or nnoonnee. In static mode, the scroll bar is displayed at all times. Dynamic mode displays the scroll bar as required, and none disables the scroll bar display. The default is static. Name: wwiiddtthh Class: WWiiddtthhCommand-Line Switch: -wwiiddtthh
Specifies the width of the scrolled list box as an entire unit. The value may be specified in any of the forms acceptable to TTkkGGeettPPiixxeellss. Any additional space needed to display the other components such as labels, margins, and scrollbars force the listbox to be compressed. A value of zero along with the same value for the height causes the value given for the visibleitems option to be applied which administers geometry constraints in a different manner. The default width is zero.DESCRIPTION
The iiwwiiddggeettss::::ssccrroolllleeddlliissttbbooxx command creates a scrolled listbox with additional options to manage horizontal and vertical scrollbars. This includes options to control which scrollbars are displayed and the method, i.e. statically or dynamically. MMEETTHHOODDSS The iiwwiiddggeettss::::ssccrroolllleeddlliissttbbooxx command creates a new Tcl command whosename is pathName. This command may be used to invoke various opera-
tions on the widget. It has the following general form: pathName option ?arg arg ...? Option and the args determine the exact behavior of the command. Many of the widget commands for a scrolledlistbox take as one argumentan indicator of which entry of the list box to operate on. These indi-
cators are called indexes and may be specified in any of the following forms:number Specifies the element as a numerical index, where 0 corre-
sponds to the first element in the listbox. aaccttiivvee Indicates the element that has the location cursor. Thiselement will be displayed with an underline when the list-
box has the keyboard focus, and it is specified with the aaccttiivvaattee widget command. aanncchhoorr Indicates the anchor point for the selection, which is set with the sseelleeccttiioonn aanncchhoorr widget command. eenndd Indicates the end of the listbox. For some commands this means just after the last element; for other commands it means the last element. @@x,,y Indicates the element that covers the point in the listbox window specified by x and y (in pixel coordinates). If no element covers that point, then the closest element to that point is used. pattern If the index doesn't satisfy one of the above forms thenthis form is used. Pattern is pattern-matched against the
items in the list box, in order from the top down, until a matching entry is found. The rules of TTccllSSttrriinnggMMaattcchh are used. The following widget commands are possible for scrolledlistbox widgets: AASSSSOOCCIIAATTEEDD MMEETTHHOODDSS aaccttiivvaattee bbbbooxx ccuurrsseelleeccttiioonn ddeelleettee ggeett iinnddeexx iinnsseerrtt iitteemmccoonnffiigguurree nneeaarreesstt ssccaann sseeee sseelleeccttiioonn ssiizzee xxvviieeww yyvviieeww See the "listbox" manual entry for details on the associated methods.WWIIDDGGEETT-SSPPEECCIIFFIICC MMEETTHHOODDSS
pathName ccggeett option Returns the current value of the configuration option given byoption. Option may have any of the values accepted by the iiwwiidd-
ggeettss::::ssccrroolllleeddlliissttbbooxx command. pathName cclleeaarr Clears the listbox of all items. pathName ccoonnffiigguurree ?option? ?value option value ...? Query or modify the configuration options of the widget. If nooption is specified, returns a list describing all of the avail-
able options for pathName (see TTkkCCoonnffiigguurreeIInnffoo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one ormore option-value pairs are specified, then the command modifies
the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the iiwwiiddggeettss::::ssccrroolllleeddlliissttbbooxx command. pathName ggeettccuurrsseelleeccttiioonn Returns the contents of the listbox element indicated by thecurrent selection indexes. Short cut version of get and curse-
lection command combination. pathName jjuussttiiffyy direction Justifies the list contents via teh scroll bars in one of four directions: lleefftt, rriigghhtt, ttoopp, or bboottttoomm. pathName sseelleecctteeddiitteemmccoouunntt Returns the number of items currently selected in the list. pathName ssoorrtt order Sort the current list in any of the forms accepted by Tcl's lsort command. Also accepts either aasscceennddiinngg or ddeesscceennddiinngg order. CCOOMMPPOONNEENNTTSS Name: lliissttbbooxx Class: lliissttbbooxx The listbox component is the listbox widget. See the "listbox" widget manual entry for details on the listbox component item. Name: hhoorriizzssbb Class: SSccrroollllbbaarr The horizsb component is the horizontal scroll bar. See the"scrollbar" widget manual entry for details on the horizsb com-
ponent item. Name: vveerrttssbb Class: SSccrroollllbbaarr The vertsb component is the vertical scroll bar. See the"scrollbar" widget manual entry for details on the vertsb compo-
nent item. EEXXAAMMPPLLEE package require Iwidgets 4.0 option add *textBackground white proc selCmd {} { puts stdout "[.slb getcurselection]" } proc defCmd {} { puts stdout "Double Click" return [selCmd] }iwidgets::scrolledlistbox .slb -selection single \
-vscrollmode static -hscrollmode dynamic -labeltext "List" \
-selectioncommand selCmd -dblclickcommand defCmd
pack .slb -padx 10 -pady 10 -fill both -expand yes
.slb insert end {Hello {Out There} World} AUTHOR Mark L. Ulferts KKEEYYWWOORRDDSS scrolledlistbox, listbox, widget Tk iwidgets::scrolledlistbox(1)