For Programmers: Free Programming Magazines  


Home > Archive > Tcl > May 2007 > tablelist delete current row









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author tablelist delete current row
tcltkdev@aol.com

2007-05-28, 8:07 am

How do I delete a row where the cursor is in a tablelist?

tcltkdev@aol.com

2007-05-28, 7:08 pm

On May 28, 6:41 pm, tcltk...@aol.com wrote:
> How do I delete a row where the cursor is in a tablelist?


..toplevel.mytablelist delete active

tcltkdev@aol.com

2007-05-28, 7:08 pm


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.

tcltkdev@aol.com

2007-05-30, 4:18 am

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"
}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com