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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 22日 (土) 06:36:15 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees
-------------------------
@@ -126,7 +126,7 @@
      treeview.append_column(buy_column)
 
 
-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.
+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 for which the Boolean, Integer and String data types are defined. 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::TreeStor
 e#append(parent=nil)), whereas 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.
 
 Adding columns and renderers renderers is performed in the same manner with both list and tree models, because columns are part of the view not the model:
 :Reminder: What is MVC




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