Re: Formatted text for tables.

I'd gathered I could pango markup, i just didn't know how to go about it.

First, i had tried setting the markup attribute the long way via Gtk2::TreeViewColumn::set_cell_data_func() like this

$column->set_cell_data_func ($filename, sub {
      my ($column, $cell, $model, $iter) = @_;
      my $cell->set( 'markup' => markupTextAtIter($model, $iter) );

It wasn't until you hinted "little simpler" that I realized you could store the markup in the TreeView's model and have it displayed directly like this.

$columns->add_attribute( $cellrenderer, 'markup', MARKUP_COLUMN );

Thanks a lot, I really appreciate it.


On Feb 13, 2008 1:51 PM, muppet <scott asofyet org> wrote:

On Feb 13, 2008, at 7:57 AM, Shalom Bhooshi wrote:

> I think I need more coffee.
> I've found
> and
> Colour text in a Gtk2::CellRendererText in a Gtk2::TreeView
> (
> That's the text colours sorted, just need to figure out how to
> adjust boldness/italics now.

You can do per-word or per-character colors and decorations with Pango

> PPS. I've attached the attempt at a prototype i've been working on

If you add the "markup" attribute instead of the "text" attribute, you
can put <b>$_</b> and such in that column and things are a little

elysse:  You dance better than some.
me:  "Some" what?
elysse:  Some asparagus.

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