Bug in Tree widget? 
Author Message
 Bug in Tree widget?

The following example program creates a tree widget with three items
and then calls autosetmode. The problem is that I cannot open the
first item.  Is there a bug in my program or in Perl/Tk?

I've tested this with Perl/Tk 800.014 on a Solaris system and Perl/Tk
800.015 on a Debian system.

#!/usr/bin/env perl

use strict;
use Tk;


              subitems => ["item1", "item2"]},
             {name => "bar",
              subitems => ["item1", "item2"]},
             {name => "baz",
              subitems => ["item1", "item2"]});

my $mw = MainWindow->new;
my $tree = $mw->Scrolled("Tree", -scrollbars => "osoe",
                         -background => "white",
                         -width => 20, -height => 10);
$tree->pack(-expand => 1, -fill => "both");
my $e;

    $e = $tree->addchild("");
    $tree->itemCreate($e, 0, -itemtype => "text", -text => $item->{name});

        my $child = $tree->addchild($e);
        $tree->hide("entry", $child);
        $tree->itemCreate($child, 0, -itemtype => "text", -text => $subitem);
    }

Quote:
}

$tree->autosetmode;

MainLoop;



Tue, 24 Sep 2002 03:00:00 GMT  
 Bug in Tree widget?
I'm not sure what the problem is (I get the same problem as you
on Solaris and Tk 800.015), but the following code works for me:

#!/usr/bin/env perl

use strict;
use Tk;


              subitems => ["item1", "item2"]},
             {name => "bar",
              subitems => ["item1", "item2"]},
             {name => "baz",
              subitems => ["item1", "item2"]});

my $mw = MainWindow->new;
my $tree = $mw->Scrolled("Tree", -scrollbars => "osoe",
                         -background => "white",
                         -width => 20, -height => 10);
$tree->pack(-expand => 1, -fill => "both");
my $e;


    $tree->add($item->{name}, -itemtype => "text",
         -text => $item->{name});

        $tree->add($item->{name}.".$subitem",
                -itemtype => "text", -text => $subitem);
    }
    $tree->setmode($item->{name} => 'close');
    $tree->close($item->{name});

Quote:
}

MainLoop;
Quote:

> The following example program creates a tree widget with three items
> and then calls autosetmode. The problem is that I cannot open the
> first item.  Is there a bug in my program or in Perl/Tk?

> I've tested this with Perl/Tk 800.014 on a Solaris system and Perl/Tk
> 800.015 on a Debian system.

> #!/usr/bin/env perl

> use strict;
> use Tk;


>               subitems => ["item1", "item2"]},
>              {name => "bar",
>               subitems => ["item1", "item2"]},
>              {name => "baz",
>               subitems => ["item1", "item2"]});

> my $mw = MainWindow->new;
> my $tree = $mw->Scrolled("Tree", -scrollbars => "osoe",
>                          -background => "white",
>                          -width => 20, -height => 10);
> $tree->pack(-expand => 1, -fill => "both");
> my $e;

>     $e = $tree->addchild("");
>     $tree->itemCreate($e, 0, -itemtype => "text", -text => $item->{name});

>         my $child = $tree->addchild($e);
>         $tree->hide("entry", $child);
>         $tree->itemCreate($child, 0, -itemtype => "text", -text => $subitem);
>     }
> }
> $tree->autosetmode;

> MainLoop;



Tue, 24 Sep 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Bug in Tree widget

2. Is there a Tree widget in perlTk that resembles the Tree widget in Tk

3. pTk 8.4.24 widget patch #1 - widget demo and friends bug fixes/modernizations

4. Hierarchical file-tree widgets anywhere?

5. prob. with tree widget

6. Tree Widget Trouble...

7. tree widget question

8. colors in Tree widget

9. Tree Widget actual size

10. Tree widget misbehaviour

11. Drawing pixels into a Tree/HList widget

12. tree view widget?

 

 
Powered by phpBB® Forum Software