Updated 2014-11-21 11:33:20 by Superlinux

This is an Example I asked the author of the tcl package about the widget tablelist ( i.e. [package require tablelist] ) Mr. Csaba Nemethi.

I think it's good to show an example on how to wrap the text of all the cells of a tablelist.

You have to understand there is NO GLOBAL Wrapping Option

package tablelist is already found in ActiveTcl repository through the teapot/teacup system.

Just run the following command, if you have ActiveTcl installed, on your shell/terminal/DOS prompt to install package tablelist:
teacup update 

The Example:

To configure and wrap the column number 3 of a tablelist on window path .mytablelist :
package require tablelist

#Defining and displaying the tablelist
tablelist::tablelist .mytablelist  -width 150 -height 10 -selectmode single -columns {  20 "Customer ID" 20 "First Name" 10 "Father Name" 15 "Last Name" }
pack .mytablelist

#This is the configuration line:
.mytablelist columnconfigure 3 -wrap true

Therefore, to configure and wrap ALL the columns of a tablelist on window path .mytablelist :
package require tablelist

#Defining and displaying the tablelist
tablelist::tablelist .mytablelist  -width 150 -height 10 -selectmode single -columns {  20 "Customer ID" 20 "First Name" 10 "Father Name" 15 "Last Name" }
pack .mytablelist

#This is the configuration line:
#The list variable $lst should look like this after running the for loop below
# from column number 1 till the number of columns in the tablelist represented by $colCount
#  {1 -wrap true 2 -wrap true 3 -wrap true ...  $colCount -wrap true }
set lst {}
    set colCount [.mytablelist columncount]
    for {set col 0} {$col < $colCount} {incr col} {
        lappend lst $col -wrap true
    }
    .mytablelist configcolumnlist $lst