Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Formatted Text in Gtk::TreeView

Reply
Thread Tools

Formatted Text in Gtk::TreeView

 
 
Michael Gebhart
Guest
Posts: n/a
 
      02-27-2005
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?

Greetings

Michael
 
Reply With Quote
 
 
 
 
Masao Mutoh
Guest
Posts: n/a
 
      02-27-2005
Hi,

On Sun, 27 Feb 2005 19:49:58 +0900
Michael Gebhart <(E-Mail Removed)> 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...kupFormat.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[
<b>bold</b>
<span foreground="#dddddd">Grey colored</span>
<u>Underlined</u>
]

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<(E-Mail Removed)>


 
Reply With Quote
 
 
 
 
Michael Gebhart
Guest
Posts: n/a
 
      02-27-2005
Yeah great, thanks!!

Michael
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java based HTML parser that outputs a formatted text string? Harry Bosch Java 1 08-03-2005 06:05 PM
How To Display Formatted Text with ASP.NET ? kbolster20@yahoo.com ASP .Net 2 01-28-2005 08:13 PM
Add formatted text to JavaScript function call during ItemDataBound of a Repeater Control. Bryan ASP .Net 1 10-26-2004 05:03 AM
Formatted text field John M Java 5 12-21-2003 12:51 PM
Server-side Printing With Formatted Text Stuart Woodard ASP .Net 0 08-03-2003 05:53 PM



Advertisments