Re: tablelist: embed abutton in cells



luckygiurato@xxxxxxxxx wrote:
Thank you for the reply.
Before writing my code, I take a look to your demo code and to the
documentation.
I copied part your code.

This is a frame of "my" code, where I insert data extracted from the
database in the tablelist:
for { set i 0 } { $i < $list_dimesion } { incr i } {
set item [ lindex $my_list $i ]
set item [ linsert $item 0 "" ]
$tbl insert end $item
$tbl cellconfigure $i,0 -window createButton
}

proc createButton {tbl row col w} {
button $w -text "edit $row" -command [ puts "ROW: $row" ]
}

Your problem is in the definition of the -command. You are saying "run the command 'puts "ROW: $row"', and use the result of that as the value for the -command option". That's almost certainly not what you intend.

Try this:

button $w -text "edit $row" -command [list puts "ROW: $row"]
.


Quantcast