dneedles2 has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm *still* learning PerkTK and found some "interesting" features with Tk::Tree widget under Windows 2000 using ActiveState v5.6.0. Specificly: 1. The data content and columns will resize but its framing window will not. (I could find no way to sync the two and force both to stay either fixed or flex) 2. If you shrink the window down and expand it back out, the adjusting bar will NOT follow and remain shrunk. 3. The SELECTED row will color to the borders of the fixed window but the NON SELECTED rows will not. So........... Is there anyway to force it to either: 1. Keep its column sizes fixed. 2. Make NON SELECTED rows color to the border like the selected row. 3. Is there another facility that doesn't have these nice features 8~) Also, does this behavior only exist on Windows 2K? Here's two examples the first with one column the second with two columns. (NOTE: For some reason the tree wanted the ItemStyle defined as ImageText instead of Text. This also made no sense to me): . SINGLECOLUMNTREE.pl---------------------------------------
#!/usr/bin/perl -w use strict; # Import modules. # use Tk; use Tk::Tree; use Tk::ItemStyle; use Tk::Adjuster; # Create a new main window. # my $top = new MainWindow( -title => "Tree" ); my $adj = $top->Adjuster(); # Create a scrollable Tree widget. # my $tree = $top->Scrolled( 'Tree', -separator => '/', -scrollbars => 'osoe', -selectbackground => 'blue', # -selectmode=>'extended', -header=>1, -height => 20, -columns=>1, -width => 30)->pack( -side => 'top', -anchor=>'n', -expand=>'1', -fill => 'both'); $tree->packAdjust(-side => 'left', -fill => 'both', -delay => 1); $tree->header("create",0,-text=>"Food "); my @colors; $colors[1] = $tree->ItemStyle('imagetext', -foreground=>'white', -activebackground=>'black', -background=>'#cc0000', -font => "Helv 7 bold", -wraplength => '40', # -tabs => 'right' # -spacing2 => 6 ); $colors[2] = $tree->ItemStyle('imagetext', -foreground=>'white', -font => "Helv 7 bold", -background=>'#ff6600' ); $colors[3] = $tree->ItemStyle('imagetext', -foreground=>'black', -font => "Helv 7 bold", -background=>'#ffff00' ); $colors[4] = $tree->ItemStyle('imagetext', -foreground=>'black', -font => "Helv 7 bold", -background=>'#ffff99' ); # Fill the tree with information. # $tree->add("food", -text => "Food", -style=>$colors[1]); $tree->add("food/dairy",-text => "Dairy a", -style=>$colors[1]); $tree->add("food/dairy/milk", -text => "Milk", -style=>$colors[2]); $tree->add("food/dairy/cheese",-text => "Cheese", -style=>$colors[3]); $tree->add("food/dairy/yogurt",-text => "Yogurt", -style=>$colors[4]); $tree->add("food/meat", -text => "Meat", -style=>$colors[1]); $tree->add("food/meat/pork", -text => "Pork", -style=>$colors[2]); $tree->add("food/meat/beef", -text => "Beef", -style=>$colors[3]); $tree->add("food/meat/poultry",-text => "Poultry Big test here", -styl +e=>$colors[4]); $tree->autosetmode(); # Add collapse/expand controls. MainLoop();
MULTICOLUMNTREE.pl---------------------------------------
#!/usr/bin/perl -w use strict; # Import modules. # use Tk; use Tk::Tree; use Tk::ItemStyle; use Tk::Adjuster; # Create a new main window. # my $top = new MainWindow( -title => "Tree" ); $top->geometry("800x600"); my $adj = $top->Adjuster(); # Create a scrollable Tree widget. # my $tree = $top->Scrolled( 'Tree', -separator => '/', -scrollbars => 'osoe', -selectbackground => 'blue', # -selectmode=>'extended', -header=>1, -height => 20, -columns=>2, -width => 30)->pack( -side => 'top', -anchor=>'n', -expand=>'1', -fill => 'both'); $tree->packAdjust(-side => 'left', -fill => 'both', -delay => 1); $tree->header("create",0,-text=>"Food "); $tree->header("create",1,-text=>"Count"); my @colors; $colors[1] = $tree->ItemStyle('imagetext', -foreground=>'white', -activebackground=>'black', -background=>'#cc0000', -font => "Helv 7 bold", -wraplength => '40', -justify => "right" ); $colors[2] = $tree->ItemStyle('imagetext', -foreground=>'white', -font => "Helv 7 bold", -background=>'#ff6600' ); $colors[3] = $tree->ItemStyle('imagetext', -foreground=>'black', -font => "Helv 7 bold", -background=>'#ffff00' ); $colors[4] = $tree->ItemStyle('imagetext', -foreground=>'black', -font => "Helv 7 bold", -background=>'#ffff99' ); # Fill the tree with information. # $tree->add("food", -text => "Food", -style=>$colors[1]); $tree->itemCreate("food",1,-text=>"6",-style=>$colors[1]); $tree->add("food/dairy",-text => "Dairy a", -style=>$colors[1]); $tree->add("food/dairy/milk", -text => "Milk", -style=>$colors[2]); $tree->add("food/dairy/cheese",-text => "Cheese", -style=>$colors[3]); $tree->add("food/dairy/yogurt",-text => "Yogurt", -style=>$colors[4]); $tree->add("food/meat", -text => "Meat", -style=>$colors[1]); $tree->add("food/meat/pork", -text => "Pork", -style=>$colors[2]); $tree->add("food/meat/beef", -text => "Beef", -style=>$colors[3]); $tree->add("food/meat/poultry",-text => "Poultry Big test here", -styl +e=>$colors[4]); $tree->autosetmode(); # Add collapse/expand controls. MainLoop();
Any assistance would be appreciated.