[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-treev-parts

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 20日 (木) 05:08:54 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-parts
-------------------------
@@ -269,8 +269,20 @@
 
 Columns are directly associated with cell renderer as well as with tree view. These relationships can be seen in the following code segment: 
 
- column = Gtk::TreeViewColumn.new("Buy", renderer, "text" => BUY_IT)
+ column = Gtk::TreeViewColumn.new("Buy", renderer, :text => BUY_IT)
  treeview.append_column(column)
+
+
+or more verbose equivalent:
+
+ renderer = Gtk::CellRendererText.new
+ column.pack_start(pixb_renderer, false)
+ #column.add_attribute(renderer, :text, BUY_IT)
+ column.set_attributes(renderer, :text => BUY_IT)
+ treeview.append_column(column)
+
+Note, that in the second code segment you could use either of Gtk::TreeViewColumn#set_attributes or Gtk::TreeViewColumn#add_attribute instance methods to associate a the cell renderer with model column number.  
+
 
 
 When defining a tree view column we need to provide the text for the header ("Buy" in our case here), the renderer to be used to render all the cells for this column in every row of this list store, and any number of attribute name/value pairs in a hash, where the name represents the attribute/property name and((*the value represents the column number.*))It is very important to realize that you can not set property values here. For instance one can not set((*:foreground*))attribute's value to a desired colour within Gtk::TreeViewColumn.new code as is shown in the following erroneous code segment:




ruby-gnome2-cvs メーリングリストの案内
Back to archive index