Re: Add images recursively to tablelist cells?



slebetman@xxxxxxxxx wrote:
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.

That helped, thanks.

--
Cheers,

Kevin Walzer, PhD
WordTech Software - "Tame the Terminal"
http://www.wordtech-software.com
sw at wordtech-software.com
.



Relevant Pages

  • Using a custom attribute in aspx pages
    ... Public Class SomeClass ... ... Using reflection, I am able to find all attributes within the App_Code ... foreach { ... because they don't reside within the App_code folder, ...
    (microsoft.public.dotnet.languages.csharp)
  • ContextSwitchDeadlock
    ... It navigates a folder tree of N-Levels and it moves all the files from each folder to the root folder, ... foreach ) ... The CLR has been unable to transition from COM context 0x1f6050 to COM context 0x1f61c0 for 60 seconds. ... The thread that owns the destination context/apartment is most likely either doing a non pumping wait ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Set a foreach to a file connection
    ... Create a string variable with the original file folder path you need. ... Within the ForEach Loop Editor choose to set an expression. ... So I am in SQL Server Business Intelligence Development Studio 2008. ...
    (microsoft.public.sqlserver.datawarehouse)
  • Re: Recursive Reading : Corrected
    ... It might take you a while but you'll probably see how the folder tree is ... protected void MessContents(DirectoryInfo root) ... foreach ) ... foreach (FileInfo NextFile in root.GetFiles()) ...
    (microsoft.public.dotnet.languages.csharp)