I searched here for Tk::Tree and did not find a relevant article, CPAN, and O'Reilly ... but the answer is elusive.
I am able to populate a Tk::Tree with a structure, and after some processing, I would like to change the color of an entry is the tree - but I can't get the call and syntax right.
Here's the sample Tk::Tree code:
1. Try itemConfigure:use Tk; use Tk::Tree; my $mw = MainWindow->new(-title => 'Tree'); my $tree = $mw->Tree->pack(-fill => 'both', -expand => 1); foreach (qw/orange orange.red orange.yellow green green.blue green.yel +low purple purple.red purple.blue/) { $tree->add($_, -text => $_); } # Different things to try here $tree->autosetmode(); MainLoop;
Error:$tree->itemConfigure('orange.red', 0, -foreground => 'blue');
2. Try itemConfigure with a '1' since altering orage.red would be in column 1 of a HList:Bad option `-foreground' at C:/Strawberry/perl/site/lib/Tk.pm line 251 +.
Error:$tree->itemConfigure('orange.red', 1, -foreground => 'blue');
3. OK. Try option -fill instead of -foreground because of other observed inconsistencies in Tk:Column "1" does not exist at C:/Strawberry/perl/site/lib/Tk.pm line 25 +1.
Error:$tree->itemConfigure('orange.red', 0, -fill => 'blue');
Bad option `-fill' at C:/Strawberry/perl/site/lib/Tk.pm line 251.
I've tried configure, itemConfigure, entryConfigure (that's for menus) and I'm just not getting it right.
Please help!
In reply to Tk::Tree how to set color of entry after tree creation by EnzoXenon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |