On May 29, 7:22 am, tcltk@aol.com wrote:
> ID No. Last Name First Name
> -----------------------------------------------------
> 1234 Smith John
> 0070 Bond James
> 7890 Bauer Jack
> Based on the illustration above, how do I loop through the tablelist
> to get similar output above? I want to process all the rows and
> columns in the tablelist.
set rowcount [.toplevel.mytablelist size] ; # Get number of rows
puts "ID No. Last Name First Name"
puts "-----------------------------------------------------"
# Process all rows in tablelist
for { set i 0 } { $i < $rowcount } { incr i } {
set record [.toplevel.mytablelist rowcget $i -text] ; #
Process a row
set IDNo [ lindex $record 0 ]
set LastName [ lindex $record 1 ]
set FirstName [ lindex $record 2 ]
puts "$IDNo $LastName $FirstName"
}