Posted to tcl by aspect at Tue Dec 30 06:28:42 GMT 2014view pretty

package require tablelist
namespace import tablelist::tablelist
pack [tablelist .t -columns {0 foo 0 bar 0 baz 0 quuuux}]
.t insert end {there once was a}
.t insert end {who took a young}
.t insert end {back of the barn}
.t insert end {where he gave her}

bind .t <<TablelistSelect>> {select %W}
bind .t.body <Button-1> {press %W}

proc select args {
    set cur [.t curselection]
    set val [.t get $cur]
    puts "select: $val"
}

proc press args {
    lassign [winfo pointerxy .t] x y
    incr x [expr {-[winfo rootx .t]}]
    incr y [expr {-[winfo rooty .t]}]
    set cell [.t containingcell $x $y]
    set cur [lindex [split $cell ,] 0]
    set val [.t get $cur]
    puts "press: $val"
}

if {!$tcl_interactive} {
    wm protocol . WM_DELETE_WINDOW exit
    vwait forever
}