ruby-****@sourc*****
ruby-****@sourc*****
2012年 11月 24日 (土) 12:03:01 JST
------------------------- REMOTE_ADDR = 184.145.95.170 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-addrnhs ------------------------- @@ -695,7 +695,7 @@ "Add Or Remove Product(s)", nil, Gtk::Dialog::MODAL, - [ Gtk::Stock::DELETE, Gtk::Dialog::RESPONSE_DELETE_EVENT ], + [ Gtk::Stock::DELETE, Gtk::Dialog::RESPONSE_REJECT ], [ Gtk::Stock::ADD, Gtk::Dialog::RESPONSE_OK ], [ Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL ] ) @@ -741,7 +741,7 @@ child[NAME_COLUMN] = product child[PRICE_COLUMN] = price fix_parent_row_prices(treeview, selected_row_path, price) if price > 0 - elsif response == Gtk::Dialog::RESPONSE_DELETE_EVENT + elsif response == Gtk::Dialog::RESPONSE_REJECT model = treeview.model iter = model.get_iter(selected_row_path) @@ -818,7 +818,7 @@ In the early days, when the API documentation was scarce, I had to check that no children dangle around, when their parents were removed from the tree. This is also a reasonable exercise for a beginner GTK+ developer. Here is the original removal code from our example program: - elsif response == Gtk::Dialog::RESPONSE_DELETE_EVENT + elsif response == Gtk::Dialog::RESPONSE_REJECT model = treeview.model iter = model.get_iter(selected_row_path) removed_price = -iter[PRICE_COLUMN] @@ -829,7 +829,7 @@ In order to check, if children are removed, we need to remember their position in the tree view before we remove their parent. We learned that the proper way to do this is to store the references to the pertinent row paths. We will not check for more than the first generation of descendants. Lets see how the above code is augmented in order to perform our test: - elsif response == Gtk::Dialog::RESPONSE_DELETE_EVENT + elsif response == Gtk::Dialog::RESPONSE_REJECT model = treeview.model iter = model.get_iter(selected_row_path)