From: Masao Mutoh Date: 2005-02-27T20:30:01+09:00 Subject: Re: Formatted Text in Gtk::TreeView Hi, On Sun, 27 Feb 2005 19:49:58 +0900 Michael Gebhart wrote: > Hi, > > I wanna have some formatted text in my treeview. The problem is: I wanna > have different formats in one cell, that means: > > I have one cell. In this cell, there are 3 lines of text. The first line > has to be bold, the second one grey colored, and the third one underlined. > > I've read the tutorial about the treeview and I know, that I have to use > the cellrenderer. But now I only can set the format for the whole cell, > not for each line different. > > Any ideas, how to do this? Use Gtk::CellRendererText#markup=. Pango Text Attribute Markup Language is similer HTML/CSS and you can apply it to Gtk::Widgets which have #markup= method. http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html --------------------------------------- require 'gtk2' Gtk.init model = Gtk::TreeStore.new(String) tv = Gtk::TreeView.new(model) cell = Gtk::CellRendererText.new column = Gtk::TreeViewColumn.new("Title", cell, :markup => 0) tv.append_column(column) msg = %Q[ bold Grey colored Underlined ] 2.times do iter = model.append(nil) model.set_value(iter, 0, msg) end window = Gtk::Window.new.add(tv).set_default_size(300,300).show_all -- .:% Masao Mutoh