use Tk::Tree; my $mw = MainWindow->new; my $tree = $mw->ScrlTree(-indicator=>1, -browsecmd=>\&abba_browse,) ->pack(-fill => 'both', -expand => 1); my $styleref_select_parent = $tree->ItemStyle('imagetext', -stylename => 'stylename_select_parent', -selectbackground=>'cyan', -selectforeground=>'blue', -font=> [-family => 'Linotype Birka', -size => 20, -weight => 'bold', -slant => 'roman', -underline => 1, -overstrike => 1]); my $styleref_select_child = $tree->ItemStyle('imagetext', -stylename => 'stylename_select_child', -selectbackground=>'cyan', -selectforeground=>'red', -font=> [-family => 'Linotype Birka', -size => 10, -weight => 'bold', -slant => 'roman', -underline => 0, -overstrike => 0]); $tree->add('ABC', -text => 'Text is: ABC', -state=>'normal'); $tree->add('ABC.def', -text => 'Text is: def', -state=>'normal'); $tree->add('ABC.def.ghi', -text => 'Text is: ghi', -state=>'normal'); $tree->setmode(); $tree->close('ABC.def'); my $tree_element; MainLoop; sub abba_browse { $tree_element = $tree->info('selection')->[0]; if ($tree_element eq 'ABC') { $tree->entryconfigure($tree->info('selection'), -style=>$styleref_select_parent); } else { $tree->entryconfigure($tree->info('selection'), -style=>$styleref_select_child); } }