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.

In reply to PerlTk Tree Widet and Funky by dneedles2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.