[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: trees - newbie question



muppet wrote:
>> I went to that project and noticed it all seems a few years old. I
>> tried to install Gtk2::Ex::Simple::Tree but it fails its tests. I
>> forced the install and ran the example program. It runs but the OK
>> button callback is buggy (using an unimplemented method). I changed
>> the example to make one of the columns editable and discovered that
>> the change doesn't persist (the widget is editable but reverts to its
>> previous text).
> 
> What versions of everything are you using?  Specifically, what versions
> of gtk+, Gtk2, and Gtk2::Ex?  Which unit tests failed?  For
> Gtk2::Ex::Simple::Tree, did you also install Gtk2::Ex::Simple::List?

There's more detail in my bug report on rt.cpan. I'm not sure I put all
the versions there: gtk2 is 2.6.4-6.7 (Suse pkg), Gtk2 is 1.144,
Gtk2::Ex is 0.50. The unit test fail and cause is as reported later on
this list by Roderich Schupp. I had installed Gtk2::Ex::Simple::List by
that time, because Tree fails to install otherwise :(  I put a separate
bug report on RT for that.


> There are more examples of using Gtk2::Tree* in the Gtk2 source under
> examples/ and demo/, and other programs available on the web.  You can
> also try the Gtk+ 2.0 Tree View Tutorial, linked from
> http://gtk2-perl.sourceforge.net/links/ .

I'd found some of those and have moved on to using TreeStore and
TreeView directly now. My initial program seems to be working pretty
well. I found one little oddity. My code for the callbacks for my expand
and collapse buttons looks like this:

    my $xa_button = Gtk2::Button->new ('Expand All');
    $bbox->pack_start($xa_button, FALSE, TRUE, 0);
    $xa_button->signal_connect(clicked =>
        sub {
                $tree_view->expand_all;
                $tree_view->queue_draw; # doesn't redraw automatically
            }
    );

    my $ca_button = Gtk2::Button->new ('Collapse All');
    $bbox->pack_start($ca_button, FALSE, TRUE, 0);
    $ca_button->signal_connect(clicked => sub { $tree_view->collapse_all });

The code for collapse is what I'd expect, but I had to add an extra line
to expand because it doesn't redraw the tree. I don't know whether I'm
missing something?


Thanks again,
Dave



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]