ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 21日 (金) 10:46:05 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees ------------------------- @@ -114,7 +114,7 @@ window.show_all Gtk.main -The only difference between a Gtk::TreeView employing the Gtk::TreeStore instead of the Gtk::ListStore is in the creation nut not in the structure of the ((*store,*))hence the tree model here keeps the same structure, than the list model in 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. Additionally the total numbers of items to be bought in either category is calculated in separate sub-loop for each category. Note, that this processing arrangement requires that all categories are bundled together in the initialization array of GroceryItem objects. +The only difference between a Gtk::TreeView employing the Gtk::TreeStore instead of the Gtk::ListStore is in the creation but not in the structure of the ((*store,*))hence the tree model here keeps the same structure, than the list model in 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. Additionally the total numbers of items to be bought in either category is calculated in separate sub-loop for each category. Note, that this processing arrangement requires that all categories are bundled together in the initialization array of GroceryItem objects. 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: