iwidgets::scrolledlistbox(1)
β¨ iwidgets::scrolledlistbox β¨
okay bestie, you've landed on the iwidgets::scrolledlistbox(1) page from the [incr Widgets] manual and honestly? it's giving iconic. it's a scrolled listbox. it scrolls. it lists. it has options. let's get into it π
πΈ NAME πΈ
iwidgets::scrolledlistbox β create and manipulate scrolled listbox widgets. yes that's the whole vibe, and yes, it's everything π
π¦ SYNOPSIS π¦
iwidgets::scrolledlistbox pathName ?options?
π INHERITANCE π
so the family tree goes like this, oldest ancestor first:
itk::Widget <- iwidgets::Labeledwidget <- iwidgets::Scrolledwidget <- iwidgets::Scrolledlistbox
like, it inherited the whole bloodline. main character energy fr fr β
π STANDARD OPTIONS π
these are the classic ones every well-behaved widget shows up with:
activeBackgroundbackgroundborderWidthcursorexportSelectionforegroundhighlightColorhighlightThicknessreliefselectBackgroundselectBorderWidthselectForeground
see the "options" manual entry for the deets on all the standard options π
π ASSOCIATED OPTIONS π
these ones are borrowed besties from other widgets:
selectModelistvariable
see the "listbox" widget manual entry for details on the above associated options.
and also:
activeReliefelementBorderwidthjumptroughColor
see the"scrollbar"widget manual entry for details on the above associated options. (yes,jumptroughColoris spelled exactly like that, i don't make the rules π)
π§ INHERITED OPTIONS π§
inherited from the ancestors, obviously:
disabledForegroundlabelBitmaplabelFontlabelImagelabelMarginlabelPoslabelTextlabelVariablestatesticky
see the"labeledwidget"class manual entry for details on the inherited options. (and yes,labelFontlabelImageis written exactly like that up there β copying it character for character, no cap π«Ά)
π WIDGET-SPECIFIC OPTIONS π
now THIS is the good part. the options that are hers. π
- Name:
dblClickCommandβ Class:Commandβ Command-Line Switch:-dblclickcommand
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:
heightβ Class:Heightβ Command-Line Switch:-height
Specifies the height of the scrolled list box as an entire unit. The value may be specified in any of the forms acceptable to Tk_GetPixels. 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:
hscrollModeβ Class:ScrollModeβ Command-Line Switch:-hscrollmode
Specifies the the display mode to be used for the horizontal scrollbar: static, dynamic, or none. 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:
sbWidthβ Class:Widthβ Command-Line Switch:-sbwidth
Specifies the width of the scrollbar in any of the forms acceptable to Tk_GetPixels. The default width is 15 pixels.. (two periods. she's dramatic. keep it π
)
- Name:
scrollMarginβ Class:Marginβ Command-Line Switch:-scrollmargin
Specifies the distance between the listbox and scrollbar in any of the forms acceptable to Tk_GetPixels. The default is 3 pixels.
- Name:
selectionCommandβ Class:Commandβ Command-Line Switch:-selectioncommand
Specifies a Tcl command procedure which is called when an item is selected. Selection policy does not matter.
- Name:
stateβ Class:Stateβ Command-Line Switch:-state
Specifies one of two states for the listbox: normal or disabled. If the listbox is disabled then selection is ignored. The default is normal.
- Name:
textBackgroundβ Class:Backgroundβ Command-Line Switch-textbackground
Specifies the background color for the listbox. This allows the background within the listbox to be different from the normal background color.
- Name:
textFontβ Class:Fontβ Command-Line Switch:-textfont
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:
visibleitemsβ Class:VisibleItemsβ Command-Line Switch:-visibleitems
Specifies the widthxheight in characters and lines for the listbox. 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 option engaged, geometry constraints are maintained only on the listbox. 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:
vscrollModeβ Class:ScrollModeβ Command-Line Switch:-vscrollmode
Specifies the the display mode to be used for the vertical scrollbar: static, dynamic, or none. 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:
widthβ Class:Widthβ Command-Line Switch:-width
Specifies the width of the scrolled list box as an entire unit. The value may be specified in any of the forms acceptable to Tk_GetPixels. 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 iwidgets::scrolledlistbox 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.
so basically: listbox, but she brought her own scrollbars and she's managing them herself. queen behavior π
π METHODS π
The iwidgets::scrolledlistbox command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations 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 argument an indicator of which entry of the list box to operate on. These indicators are called indexes and may be specified in any of the following forms:
numberβ Specifies the element as a numerical index, where0corresponds to the first element in the listbox.activeβ Indicates the element that has the location cursor. This element will be displayed with an underline when the listbox has the keyboard focus, and it is specified with theactivatewidget command.anchorβ Indicates the anchor point for the selection, which is set with theselection anchorwidget command.endβ 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 byxandy(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 then this form is used.Patternis pattern-matched against the items in the list box, in order from the top down, until a matching entry is found. The rules ofTcl_StringMatchare used.
The following widget commands are possible for scrolledlistbox widgets:
π¦ ASSOCIATED METHODS π¦
activatebboxcurselectiondeletegetindexinsertitemconfigurenearestscanseeselectionsizexviewyview
see the "listbox" manual entry for details on the associated methods π
π WIDGET-SPECIFIC METHODS π
pathName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the iwidgets::scrolledlistbox command.
pathName clear
Clears the listbox of all items.
pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo 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 or more 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 iwidgets::scrolledlistbox command.
pathName getcurselection
Returns the contents of the listbox element indicated by the current selection indexes. Short cut version of get and curselection command combination.
pathName justify direction
Justifies the list contents via teh scroll bars in one of four directions: left, right, top, or bottom. (and yes it says teh up there, i'm not fixing her typos, i'm honoring them ππ)
pathName selecteditemcount
Returns the number of items currently selected in the list.
pathName sort order
Sort the current list in any of the forms accepted by Tcl's lsort command. Also accepts either ascending or descending order.
π§© COMPONENTS π§©
ok so a scrolledlistbox is literally a lil squad of widgets, and here's the whole roster bestie π
- Name:
listboxClass:listbox
this one is THE moment, the main character π β the listbox component is the listbox widget. wanna know everything about the listbox component item? go read the "listbox" widget manual entry, it's all in there π
- Name:
horizsbClass:Scrollbar
this is the horizontal scroll bar, the one that slides side to side π β the horizsb component. deets on the horizsb component item live in the "scrollbar" widget manual entry β¨
- Name:
vertsbClass:Scrollbar
and this is the vertical scroll bar, the up-and-down one π β the vertsb component. same deal, the "scrollbar" widget manual entry has all the vertsb component item tea π«Ά
π EXAMPLE π
here's the whole vibe in code, copy it and it will slay, no cap:
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}
likeβ¦ selCmd prints whatever you've got selected, defCmd yells "Double Click" and then runs selCmd (the way that it returns the other proc?? iconic behaviour fr fr π), and then we build the widget, pack it, and insert {Hello {Out There} World} into it. chef's kiss π
π AUTHOR π
Mark L. Ulferts
(the legend himself, we stan π«Ά)
π KEYWORDS π
scrolledlistbox, listbox, widget
and that's a wrap on this page bestie!! πΈ this one comes to you straight from the Tk corner of the world β it's iwidgets::scrolledlistbox(1) β and honestly there's no date stamp on this footer, so like, no birthday for this page I guess π go forth and scroll ur lists, u absolute icon πβ¨π¦
π¦ where this page comes from
- debian bookworm: iwidgets4-doc 4.1.1-2.1
- debian trixie: iwidgets4-doc 4.1.1-4
- ubuntu jammy: iwidgets4-doc 4.1.1-2.1
- ubuntu noble: iwidgets4-doc 4.1.1-2.1
- ubuntu resolute: iwidgets4-doc 4.1.1-4
- ubuntu stonking: iwidgets4-doc 4.1.1-4
- Copyright (c) 1995 DSC Technologies Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms