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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 10月 2日 (火) 05:46:38 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-addrnhs
-------------------------
@@ -814,5 +814,36 @@
 The accumulative nature of the product prices is handled with the((*fix_parent_row_prices*))method, which is used for both additions and removal of products from our tree view. Programmer only needs to supply negative price argument to the method when removing a product. (Note, that the model is not effected by these price manipulation processes.)
 
 
+    elsif response == Gtk::Dialog::RESPONSE_DELETE_EVENT
+
+      model = treeview.model
+      iter = model.get_iter(selected_row_path)
+      removed_price = -iter[PRICE_COLUMN]
+      puts "DELETING: #{iter[NAME_COLUMN]} ---> (#{removed_price})" 
+      fix_parent_row_prices(treeview, selected_row_path, removed_price)
+
+      rmrow_refs = []
+      if iter.has_child?
+        c_iter = iter.first_child
+        i = 0
+        begin
+          i += 1
+          puts "Child ##{i} #{c_iter[NAME_COLUMN]} to be removed"
+          rmrow_refs << Gtk::TreeRowReference.new(model, c_iter.path)
+        end while c_iter.next!
+      end
+
+      model.remove(iter)
+      
+      rmrow_refs.each do |rowref|
+        if (rmrow_ref_path = rowref.path)
+          puts "#{model.get_iter(rmrow_ref_path)[NAME_COLUMN]}"
+        else
+          puts "After remove rowref.path=[#{rowref.path}] reference does not exist"
+        end
+      end
+ 
+    end
+
 
 #### path = /(.+)(:\d+)/ =~ path ? $1 : $2  #### BUG? Gtk::TreePath#up! <<< doesn't work




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