ruby-****@sourc*****
ruby-****@sourc*****
2012年 8月 24日 (金) 09:25:00 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-rr ------------------------- @@ -12,6 +12,10 @@ Instances of Gtk::TreePath class are a very convenient objects for referring to rows within a tree model, because it can be easily represented as a human-readable string. It can also be represented as an array of integers. For instance, if you are presented with the string 3:7:5, you would start at the fourth root element (recall that indexing begins at zero) in root level. You would next proceed to the eighth child of that root element. The row in question is that child's sixth child. +You can get a new Gtk::TreePath from a path in string form using Gtk::TreePath.new(path_in_string_notation). But if you already have a Gtk::TreePath object you can convert it into its string notation with Gtk::TreePath#to_str. + +Internally Gtk::TreePath does not save a string notation, instead uses an integer array. You can get the depth (ie. the nesting level) of a tree path with Gtk::TreePath#depth. A depth of 0 is the imaginary invisible root node. As lists are just trees without child nodes, all rows in a list always have tree paths of depth 1. Gtk::TreePath#indices returns the internal integer array of a tree path. You will rarely operate with paths, but if you do, you most likely will use methods like Gtk::TreePath#up!, Gtk::TreePath#down!, Gtk::TreePath#next!, Gtk::TreePath#prev!, Gtk::TreePath#ancestor?, Gtk::TreePath#decendent?. Note that this way you can operate on tree paths which refer to rows that do not exist in model. A far more coomon way to refer to a row in a list or tree model is Gtk::TreeIter. + {{br}}