Re: Colorizing rows in SimpleList revisited



On Friday, January 2, 2004, at 07:52 PM, John McDermott wrote:

The only problem is that this gives runtime warnings for cells not
having a given attribute -- e.g. cells using the boolean renderer
don't have a foreground color.  My question is, how do I determine
whether or not a given renderer supports a particular attribute?

it is possible to list the properties supported by an object, with
$object->list_properties (or $class->list_properties).

OK, so I did:
sub Gtk2::SimpleList::set_attr {
        my ($self, $attr, $col_no) = @_;
        for(my $i = 0 ; $i < $self->get_model->get_n_columns ; $i++){
                # how to avoid warnings on non-existant attributes???

                my $col = $self->get_column($i);
                if (defined $col){
                  # print "col $i has property $attr\n" if $col->find_property($attr);
                  my @l = $col -> list_properties;
                        foreach (@l){
                                print "$i:$_->{name}\n";
                        }
                }
                $col->add_attribute($col->get_cell_renderers, $attr=>$col_no)
                  if defined $col and defined $col->get_cell_renderers;
        }
}

It lists the properties, but not ones like cell-background, foreground,
weight, etc.  It seems not to show rendring properties.  Do I need to do
something else to get those?

Also, I tried getting the specific property with find_property, but it
appears that is not defined.  Is the binding just missing?

Thanks,
--john



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