To find out what item the user double-clicked on, add something along the lines of:
$tree->bind('<Double-1>' => sub { print "Got:\n"; print " $_\n" for $tree->info('selection'); });
just after the line where you configure the -opencmd option. You'll have to modify the sub {...} to suit your purposes, of course.
As for showing the file icons, it's a little unclear exactly what you want. If you mean that you simply want a different icon for a file than for a directory, then you can simply change the image requested in the dyntree_adddir sub depending on whether the item being added tests as a directory or not (-d).
If, however, you mean that you want, say, a different icon for each different file type (eg, the way MS's Explorer shows different icons depending on the extension of the file), that is rather more difficult. First of all, you'll have to decide how you want to determine which file gets which icon. Then you need to decided where you want to get all those icons from (eg, do you want to try and extract them from the OS, or do you want to carry around a bunch of images files with your program). Once you've decided those things, then you can start figuring out how to add those icons in to the program.
bbfu
Black flowers blossom
Fearless on my breath
In reply to Re2: using TK tree or dirtree
by bbfu
in thread using TK tree or dirtree
by michaelg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |