ruby-****@sourc*****
ruby-****@sourc*****
2012年 8月 24日 (金) 10:26:59 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-rr ------------------------- @@ -78,6 +78,26 @@ +==== Converting Tree Iterators to Paths or Paths to Iterators + +Tree iters can easily be converted into tree paths using Gtk::TreeIter#path, and tree paths can easily be converted into tree iters using Gtk::TreeModel#get_iter. For example: + + path = an_iter.path + store = treeview.model + iter = store.get_iter(path) # where path : The Gtk::TreePath or a String representation of a Gtk::TreePath. + +Converting a path to the coresponding iterator is obvious: + + path_string = "2:0:3:6" + iter = Gtk::TreePath.new(path_string) + + + + + + +{{br}} + === Tree Row References Beside an important role of watching a tree model for changes Gtk::TreeRowReference objects are extremely helpful in providing stable reference points to the information related to the constantly varying pointers to the rows in the tree model. To understand this, one has to be familiar with the tree model, hence we will defer this explanation until we gather a bit more experience with this topics. For those of you, who would like to jump ahead following is the link that talks about references as a reliable means to track the position of rows within the tree: (((<Removing Multiple Rows|tut-gtk2-treev-addrnhs#Removing Multiple Rows>))). However, as the agents that monitor for changes in the tree model, we need to know, that internally they connect to the ((*row-inserted,*)) ((*row-deleted,*)) and ((*row-reordered*)) signals, updating the stored path based on the changes.