Re: hiding progressbar in a Gtk2::TreeViewColumn




On Jul 24, 2009, at 11:34 PM, anguila wrote:

Trying the first option it seems not recognize sensible option:
GLib-GObject-WARNING **: unable to set property `visible' of type `gboolean' from value of type `gchararray'

With the second option it works, but still visible:

    $tc_pbar->set_cell_data_func ($pbar,
       sub {
           my ($column, $cell, $model, $iter) = @_;

           my $string = $model->get_string_from_iter ($iter);
           if ($string!~/\d:\d:0/) {
               # we should show the progress bar
               $cell->set (visible => FALSE, value => $value);

Is that a typo?  (Should be TRUE here, not FALSE.)

           } else {
               # we should NOT show the progress bar, so don't
               $cell->set (visible => FALSE,value=>22);
                print "pbar to off!\n";
           }
       });

All the 3rd child want to make pbar visible=>false. I tried and i can change the value of all 3rd childs to 22 and it works, but visible=>false doesn't change the state of visibility and i dont understand why because is a attribute og Gtk2::CellRenderer and it should works, but it doesn't.

Any idea?

Perplexing. A quick scan of the gtk+ sources on git.gnome.org shows that the cell's visible property is honored by TreeViewColumn when processing each row, so this should work just fine. I may be misreading that (gtktreeviewcolumn.c is 3755 lines and a web browser is not as good for reading code as vim).

Sanity check: do you have the constants TRUE and FALSE defined? (e.g. from 'use Glib qw(:constants)'). Is strict turned on? If perl is not being properly strict, it may be interpreting the bareword FALSE as a string, and 'FALSE' is not an empty string and therefore is logically true.


What if you set the other properties before setting visible, e.g.

    } else {
        # we should NOT show the progress bar
$cell->set (text => '', value => 0, width => 0, visible => FALSE);



--
Doing a good job around here is like wetting your pants in a dark suit; you get a warm feeling, but no one notices.
  -- unknown





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