ruby-****@sourc*****
ruby-****@sourc*****
2012年 8月 12日 (日) 04:09:05 JST
------------------------- REMOTE_ADDR = 184.145.90.35 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-treeview-model-reference ------------------------- @@ -17,7 +17,7 @@ Tree iters are used to retrieve data from the store, and to put data into the store. You also get a tree iter as result if you add a new row to the store using Gtk::ListStore#append or Gtk::TreeStore#append. -Tree iters are often only valid for a short time, and might become invalid if the store changes. It is therefore usually a bad idea to store tree iters. You can use Gtk::TreeModel#flags to get a model's flags, and check whether the ITERS_PERSIST flag is set (in which case a tree iter will be valid as long as a row exists), but there is a better way to keep track of a row: Gtk::TreeRowReference. +Tree iters are often only valid for a short time, and might become invalid if the store changes. It is therefore usually a bad idea to store tree iters. You can use Gtk::TreeModel#flags to get a model's flags, and check whether the Gtk::TreeModel::ITERS_PERSIST flag is set (in which case a tree iter will be valid as long as a row exists), but there is a better way to keep track of a row: Gtk::TreeRowReference. A GtkTreeRowReference is basically an object that takes a tree path, and watches the model for changes. If anything changes, like rows getting inserted or removed, or rows getting re-ordered, the tree row reference object will keep the given tree path up to date, so that it always points to the same row as before.