tixTList(n)
π tixTList(n) β Tix Built-In Commands π
okay bestie, this is the tixTList(n) page, aka the Tix Tabular List widget manual. It is long, it is iconic, and it has so many options. Letβs get into it π«Ά
β¨ NAME β¨
tixTList β Create and manipulate Tix Tabular List widgets
πΈ SYNOPSIS πΈ
tixTList pathName ?options?
π STANDARD OPTIONS π
These are the standard options, no cap:
-background-borderWidth-cursor-foreground-font-height-highlightColor-highlightThickness-relief-selectBackground-selectForeground-xScrollCommand-yScrollCommand-width
See the options manual entry for details on the standard options.
π οΈ WIDGET-SPECIFIC OPTIONS π οΈ
-browsecmdbrowsecmd β Specifies a TCL command to be executed when the user browses through the entries in the TList widget.-commandcommand β Specifies the TCL command to be executed when the user invokes a list entry in the TList widget. Normally the user invokes a list entry by double-clicking it or pressing the Return key.-foregroundforeground β Specifies the default foreground color for the list entries.-heightheight β Specifies the desired height for the window in number of characters.-itemtypeitemType β Specifies the default type of display item for this TList widget. When you call theinsertwidget commands, display items of this type will be created if the-itemtypeoption is not specified.-orientorient β Specifies the order of tabularizing the list entries. When set to"vertical", the entries are arranged in a column, from top to bottom. If the entries cannot be contained in one column, the remaining entries will go to the next column, and so on. When set to"horizontal", the entries are arranged in a row, from left to right. If the entries cannot be contained in one row, the remaining entries will go to the next row, and so on.-padxpadX β The default horizontal padding for list entries.-padxpadY β The default vertical padding for list entries.-selectbackgroundselectBackground β Specifies the background color for the selected list entries.-selectborderwidthselectBorderWidth β Specifies a non-negative value indicating the width of the 3-D border to draw around selected items. The value may have any of the forms acceptable toTk_GetPixels.-selectforegroundselectForeground β Specifies the foreground color for the selected list entries.-selectmodeselectMode β Specifies one of several styles for manipulating the selection. The value of the option may be arbitrary, but the default bindings expect it to be eithersingle,browse,multiple, orextended; the default value issingle.-sizecmdsizeCmd β Specifies a TCL script to be called whenever the TList widget changes its size. This command can be useful to implement"user scroll bars when needed"features.-statestate β Specifies whether the TList command should react to user actions. When set to"normal", the TList reacts to user actions in the normal way. When set to"disabled", the TList can only be scrolled, but its entries cannot be selected or activated.-widthwidth β Specifies the desired width for the window in characters.
π¦ DESCRIPTION π¦
The tixTList command creates a new window (given by the pathName argument) and makes it into a TList widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the TList widget such as its cursor and relief.
The TList widget can be used to display data in a tabular format. The list entries of a TList widget are similar to the entries in the Tk listbox widget. The main differences are (1) the TList widget can display the list entries in a two dimensional format and (2) you can use graphical images as well as multiple colors and fonts for the list entries.
Each list entry is identified by an index, which can be in the following forms:
- number β An integer that indicates the position of the entry in the list.
0means the first position,1means the second position, and so on. - end β Indicates the end of the listbox. For some commands this means just after the last entry; for other commands it means the last entry.
@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.
π DISPLAY ITEMS π
Each list entry in an TList widget is associated with a display item. The display item determines what visual information should be displayed for this list entry. Please see the tixDisplayStyle manual page for a list of all display items.
When a list entry is created by the insert command, the type of its display item is determined by the -itemtype option passed to these commands. If the -itemtype is omitted, then by default the type specified by this TList widget's -itemtype option is used.
π WIDGET COMMAND π
The tixTList command creates a new Tcl command whose name is the same as the path name of the TList widget's window. This command may be used to invoke various operations on the widget. It has the following general form:
pathName option ?arg arg ...?
PathName is the name of the command, which is the same as the TList widget's path name. Option and the args determine the exact behavior of the command. The following commands are possible for TList widgets:
π
pathName anchor set index
Sets the anchor to the list entry identified by index. The anchor is the end of the selection that is fixed while dragging out a selection with the mouse.
π
pathName anchor clear
Removes the anchor, if any, from this TList widget. This only removes the surrounding highlights of the anchor entry and does not affect its selection status.
π
pathName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the tixTList command.
π
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 tixTList command.
π
pathName delete from ?to?
Deletes one or more list entries between the two entries specified by the indices from and to. If to is not specified, deletes the single entry specified by from.
π
pathName dragsite set index
Sets the dragsite to the list entry identified by index. The dragsite is used to indicate the source of a drag-and-drop action. Currently drag-and-drop functionality has not been implemented in Tix yet.
π
pathName dragsite clear
Remove the dragsite, if any, from the this TList widget. This only removes the surrounding highlights of the dragsite entry and does not affect its selection status.
π
pathName dropsite set index
Sets the dropsite to the list entry identified by index. The dropsite is used to indicate the target of a drag-and-drop action. Currently drag-and-drop functionality has not been implemented in Tix yet.
π
pathName dropsite clear
Remove the dropsite, if any, from the this TList widget. This only removes the surrounding highlights of the dropsite entry and does not affect its selection status.
π
pathName entrycget index option
Returns the current value of the configuration option given by option for the entry identified by index. Option may have any of the values accepted by the insert widget command.
π
pathName entryconfigure index ?option? ?value option value ...?
Query or modify the configuration options of the list entry identified by index. If no option is specified, returns a list describing all of the available options for index (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 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 insert widget command. The exact set of options depends on the value of the -itemtype option passed to the insert widget command when this list entry is created.
π
pathName insert index ?option value ...?
Creates a new list entry at the position indicated by index. The following configuration options can be given to configure the list entry:
-itemtypetype β Specifies the type of display item to be display for the new list entry. type must be a valid display item type. Currently the available display item types areimage,imagetext,text, andwindow. If this option is not specified, then by default the type specified by this TList widget's-itemtypeoption is used.-stateβ Specifies whether this entry can be selected or invoked by the user. Must be eithernormalordisabled.
The insert widget command accepts additional configuration options to configure the display item associated with this list entry. The set of additional configuration options depends on the type of the display item given by the -itemtype option. Please see the tixDisplayStyle manual page for a list of the configuration options for each of the display item types.
π
pathName info option arg ...
Query information about the TList widget. option can be one of the following:
pathName info anchor indexβ Returns the index of the current anchor, if any, of the TList widget. If the anchor is not set, returns the empty string.
pathName info dragsite index
Returns the index of the current dragsite (if there even is one) of the TList widget. No dragsite? You get the empty string back. π
pathName info dropsite index
Same vibe, different site: returns the index of the current dropsite if any. If the dropsite isn't set, empty string, no notes. π«Ά
pathName info selection
Returns a list of the selected elements in the TList widget. If nothing's selected, it hands you an empty string β the saddest little return value. π
pathName nearest x y
You give it an (x,y) coordinate that's inside the TList window, and it gives you back the index of the TList element nearest to that coordinate. Pointy = helpful. π
pathName see index
Adjusts the view so the entry given by index is visible. If it's already visible, honestly nothing happens β the command has no effect. If the entry is near one edge of the window, the TList scrolls just enough to bring the element into view at the edge. Otherwise the widget scrolls to center the entry, main character energy, obviously. β¨
pathName selection option arg ...
This is the command for messing with the selection inside a TList widget. It's got several forms depending on option:
pathName selection clear ?from? ?to?β no extra args? Deselects all of the list entrie(s) in this TList widget. Just from? Only the list entry identified by from gets deselected. Both from and to? Deselects all the list entrie(s) between from and to, inclusive, and it leaves the selection state of anything outside that range completely alone. π§pathName selection includes indexβ Returns1if the list entry indicated by index is currently selected; returns0otherwise. Simple as that, no cap.pathName selection set from ?to?β Selects all of the list entrie(s) between from and to, inclusive, without touching the selection state of entries outside that range. Only from given? Then only the list entry identified by from is selected. π
pathName xview args
This one queries and changes the horizontal position of the info in the widget's window. Takes any of these forms:
pathName xviewβ Returns a list with two elements. Each one's a real fraction between0and1, and together they describe the horizontal span that's visible in the window. Example time, bestie: if the first element is.2and the second element is.6, then 20% of the TList entry is off-screen to the left, the middle 40% is visible in the window, and 40% of the entry is off-screen to the right. These are the exact same values passed to scrollbars via the-xscrollcommandoption. π₯pathName xview indexβ Adjusts the view so the list entry identified by index is aligned to the left edge of the window. Snapped into place. πpathName xview moveto fractionβ Adjusts the view so that fraction of the total width of the TList is off-screen to the left. fraction must be a fraction between0and1.pathName xview scroll number whatβ Shifts the view left or right according to number and what. number must be an integer. what must be eitherunitsorpages, or an abbreviation of one of those. If what isunits, the view adjusts left or right by number character units (the width of the0character) on the display; if it'spages, the view adjusts by number screenfuls. Negative number? Characters farther to the left become visible. Positive? Characters farther to the right become visible. πΈ
pathName yview ?args?
The vertical twin β this queries and changes the vertical position of the entries in the widget's window. Forms:
pathName yviewβ Returns a list of two elements, both real fractions between0and1. First element = the position of the list element at the top of the window, relative to the TList as a whole (so0.5means it's halfway through the TList, gorgeous). Second element = the position of the list entry just after the last one in the window, relative to the TList as a whole. Same values that get passed to scrollbars via the-yscrollcommandoption. β¨pathName yview indexβ Adjusts the view so the list entry given by index is displayed at the top of the window. Iconic placement. πpathName yview moveto fractionβ Adjusts the view so the list entry given by fraction appears at the top of the window. Fraction is a fraction between0and1;0indicates the first entry in the TList,0.33indicates the entry one-third the way through the TList, and so on. Math but make it cute. π¦pathName yview scroll number whatβ Adjusts the view up or down according to number and what. number must be an integer. what must be eitherunitsorpages. If what isunits, the view adjusts up or down by number lines; if it'spages, the view adjusts by number screenfuls. Negative number β earlier entries become visible; positive β later entries become visible. π
π BINDINGS π
- [1] β If the
-selectmodeis"browse", when the user drags the mouse pointer over the list entries, the entry under the pointer gets highlighted and the-browsecmdprocedure is called with one parameter: the index of the highlighted entry. Only one entry can be highlighted at a time. The-commandprocedure gets called when the user double-clicks on a list entry. No cap. π - [2] β If the
-selectmodeis"single", entries only get highlighted by mouse<ButtonRelease-1>events. When a new list entry is highlighted, the-browsecmdprocedure is called with one parameter indicating the highlighted list entry. The-commandprocedure gets called when the user double-clicks on a list entry. π - [3] β If the
-selectmodeis"multiple", when the user drags the mouse pointer over the list entries, all the entries under the pointer get highlighted. But heads up: only a contiguous region of list entries can be selected. When the highlighted area changes, the-browsecmdprocedure is called with an undefined parameter β and it's the responsibility of the-browsecmdprocedure to figure out the exact highlighted selection in the TList. The-commandprocedure gets called when the user double-clicks on a list entry. π«Ά - [4] β If the
-selectmodeis"extended", dragging the mouse pointer over the list entries highlights all the entries under the pointer. The user can also make disjointed selections using<Control-ButtonPress-1>. When the highlighted area changes, the-browsecmdprocedure is called with an undefined parameter, and it's the responsibility of the-browsecmdprocedure to find out the exact highlighted selection in the TList. The-commandprocedure gets called when the user double-clicks on a list entry. π
β¨ EXAMPLE β¨
This one demonstrates how to use a TList to store a list of numbers. Literally so satisfying:
set image [tix getimage folder]
set t [tixTList .t -orient vertical]
$t insert end -itemtype imagetext -image $image -text one
$t insert end -itemtype imagetext -image $image -text two
$t insert end -itemtype imagetext -image $image -text three
$t insert end -itemtype imagetext -image $image -text four
$t insert end -itemtype imagetext -image $image -text five
$t insert end -itemtype imagetext -image $image -text six
pack $t -expand yes -fill both
Six folders, all lined up, all packed in. Ate. π
π KEYWORDS π
Tix(n), Tabular Listbox, Display Items
And that's the whole page, bestie! π¦ This masterpiece is from Tix 4.0, and it's the tixTList(n) page, dated however long ago β go forth and build the most gorgeous tabular listbox of your life. Slay. π
π¦ where this page comes from
- opensuse-leap 16.0: tix 8.4.3-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: tix 8.4.3-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: tix 8.4.3-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: tix 8.4.3-160000.2.2 Β· BSD-3-Clause
- Copyright (c) 1993-1999 Ioi Kim Lam
- Copyright (c) 2000-2001 Tix Project Group
- (c) 1990 The Regents of the University of California
- (c) 1994-1995 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms