Re: Add images recursively to tablelist cells?
- From: "slebetman@xxxxxxxxx" <slebetman@xxxxxxxxx>
- Date: 29 Nov 2005 18:47:29 -0800
Kevin Walzer wrote:
> I'm trying to add images to all cells in a particular column of the
> tablelist widget. However, I'm not grokking how to do this.
>
> This is my example code:
>
> foreach row 0 {
> $tbl cellconfigure 0,$row -image folder
> }
'Walk' through your code:
foreach row 0 {
# You are saying for each value in the list, and your list only one
value,
# and that value is 0, assign that value to the variable row.
$tbl cellconfigure 0,$row -image folder
# Cellconfigure the table at column 0 and at specified row to the image
of a folder.
# Remember now that your list only has a single value and that is zero
so only
# cell 0,0 will be configured.
}
# End of foreach. Since your list only has a single value the foreach
will only
# iterate once (for the value 0). The foreach loop now terminates.
What you should have done is:
set rows [list 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]
foreach row $rows {
...
What you probably should be doing is:
for {set row 0} {$row < $max_row} {incr row} {
...
> The idea is that this snippet will iterate through each cell of column 0
> and append the image. But it adds only one folder, to the top cell.
>
That's not recursive now is it? It's iterative.
.
- Follow-Ups:
- Re: Add images recursively to tablelist cells?
- From: Kevin Walzer
- Re: Add images recursively to tablelist cells?
- References:
- Add images recursively to tablelist cells?
- From: Kevin Walzer
- Add images recursively to tablelist cells?
- Prev by Date: Re: Expect timeout problem. I needs help.
- Next by Date: Re: Packaging Tcl/Tk Application on Windows: Single File Executable
- Previous by thread: Add images recursively to tablelist cells?
- Next by thread: Re: Add images recursively to tablelist cells?
- Index(es):
Relevant Pages
|