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

Zurück zum Archiv-Index

ruby-****@sourc***** ruby-****@sourc*****
2012年 8月 16日 (木) 04:08:00 JST


-------------------------
REMOTE_ADDR = 70.49.49.99
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-parts
-------------------------
@@ -213,8 +213,15 @@
  column = Gtk::TreeViewColumn.new("Buy", renderer, "text" => BUY_IT)
  treeview.append_column(column)
 
-When defining a tree view column we need to provide the text for the header, the renderer to be used on the elements (rows) of this column, and any number of attribute name/value pairs in a hash, where the name represents the attribute name and the value represents the column number. In our example we are defining three individual single columns, so we have a single name/value pair for each attribute. Finally we have to add (append) our newly defined column to the tree view.
 
+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:
+
+ # The following is WRONG:
+ column = Gtk::TreeViewColumn.new("Buy", renderer, "text" => BUY_IT, :foreground => "#ff0000")  # ERROR !!!
+
+In our example program (liststore.rb) above, we are defining three individual single columns, so we have a single name/value pair for each attribute. Finally we have to add (append) our newly defined column to the tree view.
+
+
 {{image_right("dialog-warning.png")}}
 
 Following is the pertinent API documentation and an example found there,
@@ -236,8 +243,15 @@
  
      renderer = Gtk::CellRendererText.new
      column = Gtk::TreeViewColumn.new("Title", renderer, 
-                                      :text => TEXT_COLUMN,                  # ????
-                                      :foreground => COLOR_COLUMN)           # ????
+                                      :text => TEXT_COLUMN,         # COLUMN NUMBERS - NOT attribute values !!
+                                      :foreground => COLOR_COLUMN)  # COLUMN NUMBERS - NOT attribute values !!
 
 To fully comprehend the above Gtk::TreeViewColumn.new API fragment just above the questionable code example, it would be beneficial if you understand that the API fragment alludes to how to implement the same functionality as that of the ((*new*)) method, manually - with four simpler methods. So let us rewrite the following code  (the shorter fragment) from  our example program with a bit longer one, to reflect what was just said:
 




ruby-gnome2-cvs メーリングリストの案内
Zurück zum Archiv-Index