ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 9日 (火) 03:20:42 JST
------------------------- REMOTE_ADDR = 184.145.82.7 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-crs ------------------------- @@ -330,7 +330,7 @@ fix_parents_total(iter) if !iter.has_child? end -Indeed, all the work here is done in the new((*'fix_parents_total'*))method, which is called if the check-box is clicked for an item which is not the parent node, i.e. does not have children rows. In the new 'fix_parents_total' helper method we obtain parent's iter (parent), and the iter for its first child (tmp_iter), which is subsequently advanced through the list of all children rows for this product category accumulating the total value of all selected 'Count' cells in this product category's column identified by the GItm::QTY_INDEX. If a cell is selected is determined by the status of its 'Buy' column. Namely, when checked, the model's column identified by the GItm::BUY_INDEX contains value true. Finally, the parent's 'Count' value is set to the newly accumulated total value. +Indeed, all the work here is done in the new((*'fix_parents_total'*))method, which is called if the check-box is clicked for an item which is not the parent node, i.e. does not have children rows. In the new 'fix_parents_total' helper method we obtain parent's iter (parent), and the iter for its first child (tmp_iter), which is subsequently advanced through the list of all children rows for this product category in the process accumulating the total value for all the selected 'Count' cells in this product category's column identified by the GItm::QTY_INDEX. If a cell is selected is determined by the status of its 'Buy' column. Namely, when checked, the model's column identified by the GItm::BUY_INDEX contains value true. Finally, the parent's 'Count' value is set to the newly accumulated total value. def fix_parents_total(iter) parent = iter.parent