[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Gtk - Image via HTTP in TreeView

Michael Gebhart

2/11/2005 12:32:00 AM

Hi there,

I'm just writing my first ruby-gtk application. But already there are the
first problems :)

In my application I have a treeview with 2 columns. In the second column,
I wanna display some text, that works. In the first column I'm trying to
display an image. It should be a image from an external server. So first I
have to grab the image, but how should I do that? After that I have to
display it in the treeview, but this also doesn't work. Here are my first
tries:


@treeview = @glade.get_widget("treeview")

@treestore = Gtk::TreeStore.new(Gdk::Pixbuf, String)
@treeview.model = @treestore

@renderer = Gtk::CellRendererText.new

col = Gtk::TreeViewColumn.new("Image", @renderer, nil)
@treeview.append_column(col)

col = Gtk::TreeViewColumn.new("Description", @renderer, :text => 0)
#What is the :text => for? I know, that are attributes. But what can I set
here?

@treeview.append_column(col)


#Inserting an element

newStore = @treestore.append(nil)
newStore[0] = Gtk::Image.new("http://myurl/meinpicture.png")
newStore[1] = "test"


This does not work. Any ideas?


Greetings

Mike
2 Answers

Masao Mutoh

2/11/2005 6:50:00 AM

0

Hi,

On Fri, 11 Feb 2005 09:35:02 +0900
Michael Gebhart <mail@miketech.net> wrote:

> Hi there,
>
> I'm just writing my first ruby-gtk application. But already there are the
> first problems :)
>
> In my application I have a treeview with 2 columns. In the second column,
> I wanna display some text, that works. In the first column I'm trying to
> display an image. It should be a image from an external server. So first I
> have to grab the image, but how should I do that? After that I have to
> display it in the treeview, but this also doesn't work. Here are my first
> tries:

Use Gtk::CellRendererPixbuf to render pixbuf.

Try gtk/sample/misc/treeview.rb.

> col = Gtk::TreeViewColumn.new("Description", @renderer, :text => 0)
> #What is the :text => for? I know, that are attributes. But what can I set
> here?

The column of the store. In this case, 0 means Gdk::Pixbuf, 1 means String.

Read "Ruby/GTK TreeView Tutorial", please.
http://ruby-gnome2.sourceforge.jp/hiki.cgi?tu...

--
:% Masao Mutoh<mutoh@highway.ne.jp>


Michael Gebhart

2/11/2005 3:02:00 PM

0

Hi,

ok, I'll try, thanks.

Michael