ruby-****@sourc*****
ruby-****@sourc*****
2012年 9月 27日 (木) 09:12:18 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-rr ------------------------- @@ -16,6 +16,11 @@ Internally Gtk::TreePath does not save a string notation, instead it 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, this, by the way, is the only level where you initialize Gtk::TreeStore#append method with the((*nil*))argument, namely if a child has children, to obtain their respective root iterator, you'd pass to the Gtk::TreeStore#append the child which is the parent of those children. +:Imaginary, invisible root node: + + Pay attention to((*imaginary, invisible*)) here. If you do not, you will finally notice this point when inserting rows into a tree view by double clicking the row, under which, you'd like to insert a "sub-item". Namely, there is no row for the ((*imaginary, invisible row.*))That is why it is called invisible, but it is far from imaginary! We, will sdiscus this problem in the second version of the 'treev-MultiDim-load-asci-table.rb' example (- remember we announced issues for programming the insertion of new rows). + + At this point in addition to Gtk::TreeStore, we also need to address the Gtk::ListStore. 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}}