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) );
     
},
undef);

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.

Shalom

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
> http://gtk2-perl.sourceforge.net/doc/pod/Gtk2/TreeViewColumn.html#_tree_column_set_cel
> and
> Colour text in a Gtk2::CellRendererText in a Gtk2::TreeView
> (mail.gnome.org/archives/gtk-perl-list/2004-October/msg00076.html)
>
> 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
markup.

http://library.gnome.org/devel/gtk/stable/GtkCellRendererText.html#GtkCellRendererText--markup

http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html


> 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
simpler.


--
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]