Re: Gtk2::TreeView or Gtk2::SimpleList right justify?



from a discussion long ago about how to right-align the contents of a
column...

On Fri, 2003-08-08 at 11:14, muppet wrote:
this one doesn't translate so easily into SimpleList terms.  basically, you
have to fetch the column from the treeview, then fetch the renderer from the
column, and set the alignment on the renderer.  thus, you get

   ( $slist->get_column ($colno)->get_cell_renderers )[0]->set (xalign => 1.0);

which we might actually want to wrap up for SimpleList.  what do you guys think?

never saw a reply to this.  what do you guys think of something like

  sub set_column_alignment {
      my ($self, $index, $alignment) = @_;
      my $column = $self->get_column ($index);
      croak "invalid column index $index" unless defined $column;
      my ($cell) = $column->get_cell_renderers;
      $cell->set (xalign => $alignment);
  }
  sub get_column_alignment {
      my ($self, $index) = @_;
      my $column = $self->get_column ($index);
      croak "invalid column index $index" unless defined $column;
      my ($cell) = $column->get_cell_renderers;
      return $cell->get ('xalign');
  }


-- 
muppet <scott at asofyet dot org>




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