DESCRIPTION
DDG 2019-10-24: A snidget that is a listbox widget based on tablelist. In comparison to the standard listbox widget it has multiline text support and it can display on top a search entry for dynamic text search. It is in fact a tablelist widget with only one visible and one hidden column, the latter should be used for the -data option.
tlistbox demo
The **tlistbox** widget filled with some search items, which can be hard wrapped using newlines or soft wrapped if the widget is resized.
Here the search entry is used for searching **tlistbox** entries:
Example code
Here is the code to generate the example:
package require dgw::tlistbox namespace import ::dgw::tlistbox set data { {"B. Gates:\nThe Windows Operating System" "Hidden Data"} {"L. Thorwalds: The Linux Operating System"} {"C. Nemethi's: Tablelist Programmers Guide"} {"J. Ousterhout: The Tcl/Tk Programming Language"} } proc click {tbl idx} { puts [$tbl itemcget $idx -text] } tlistbox .tl -listvariable data -browsecmd click -searchentry true lappend data {"A. Anonymous: Some thing else matters"} .tl insert end {"L. Wall: The Perl Programming Language" "1987"} pack .tl -side top -fill both -expand yes .tl itemconfigure end -foreground red .tl itemconfigure end -data Hello puts "Hello? [.tl itemcget end -data] - yes!"
See also