ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 7日 (日) 05:06:22 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-pxbr ------------------------- @@ -167,4 +167,16 @@ # # store = Gtk::TreeStore.new(TrueClass, Integer, String, Gdk::Pixbuf) -Indeed, in the the 'liststore-col-w-double-renderers-pixbufs.rb' example in section [8.2.4], we use the Gdk::Pixbuf rather than the String data type to define our model (store). +Indeed, in the the 'liststore-col-w-double-renderers-pixbufs.rb' example in section [8.2.4], we use the Gdk::Pixbuf rather than the String data type to define our model (store). However note, that in both examples here, and in the section [8.2.4] the renderers are defined to be of type Gtk::CellRendererPixbuf: + + renderer = Gtk::CellRendererPixbuf.new + +The difference is in definition of the attributes which are assigned image data in their respective columns. Here we use :stock_id, whereas in the example in [8.4.2] we use the :pixbuf attribute: + + column.add_attribute(renderer, 'stock_id', $img_column) + +and in the example program in section [8.4.2] ((<(Multi-item Super Columns)|tut-gtk2-treev-trees#Multi-item Super Columns>)): + + column.set_attributes(pixb_renderer, :pixbuf => ICON) + +The add_attribute and set_attributes accomplish the same thing. If this is news to you, I suggest you reread the above mentioned section [8.4.2].