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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 22日 (土) 05:16:30 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees
-------------------------
@@ -114,7 +114,10 @@
  window.show_all
  Gtk.main
 
-With the new version of our example program we obtained slightly different presentation, namely the view, with the contents of the first column in parent nodes sitting next to the "expander arrow" adjusted to the left of that column, and the content of this very same column for children rows indented to the right side of the column, however, without the "expander arrow", so user can discern between the two kinds of rows. The model however, with the exception of new parent child division, did not change.
+With the new version of our example program we obtained slightly different presentation, namely the view, with the contents of the first column in parent nodes sitting next to the "expander arrow" adjusted to the left of that column, and the content of this very same column for children rows indented to the right side of the column, however, without the "expander arrow", so user can discern between the two kinds of rows. Unlike the view, however, the model, with the exception of new parent child division, did not change.
+
+:Note: 
+    The tree view will always use the first view column as the parent/child discriminating column, i.e. should you decide that the "Product" should be the first column in the view, it would be adorned with the "expander arrow" and the content indentation schema described above, to present the differentiation between parent and child rows.
 
 
 The only difference between the original "liststore.rb" listing and the modified "treestore.rb" version of our  Gtk::TreeView  example programs where the first employs the Gtk::ListStore and the second the Gtk::TreeStore is in the creation but not in the structure of the models i.e.((*stores,*))hence the tree model here keeps the same structure as the list model in the original program, with three columns defined as Boolean, Integer and a String. What changed is the initialization process as well as the structure of GroceryItem class, which now includes a controlling field (attribute) called @product_type, to store a flag determining the parent/child relationship, and which subsequently is used in the model (store) initialization loop to drive either parent or child nodes creation and initialization. This, by the way, is the only thing that reflects the parent child division in the model, namely parent rows are created with nil argument (Gtk::TreeStore#append(parent=nil)), w
 hereas children rows have this argument set to their respective parents. Incidentally, this is also different in the two source code listings, namely Gtk::ListStore#append comes with no argument. Additionally in our "treestore.rb" example, the total numbers of items to be bought in either category is calculated in separate sub-loop for each category. Note, that this initialization processing arrangement requires that all categories are bundled together in the initialization array of GroceryItem objects. This requirement is forced both by the creation of groups of children underneath the parent node, as well as by the way total number of products to purchase is handled.




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