[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-treev-addrnhs

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 10月 1日 (月) 06:04:47 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-addrnhs
-------------------------
@@ -571,7 +571,7 @@
  model = treeview.model
  iter = model.iter_first    #<-- same as: iter = model.get_iter("0")
 
-In the first line above we conveniently tuck away the model separating data store from the view (MVC). We use model to get to the starting iterator, either by Gtk::TreeStore#iter_first, or by Gtk::TreeStore#get_iter by supplying the top-level root path "0". Then comes a tricky while loop, where we want to process the first iteration with the iter we have just obtained, while at the same time use Gtk::TreeIter#next! as the condition in the while loop. The API for Gtk::TreeIter#next! tells us that this command returns true if the iterator was successfully advanced and false otherwise. In this case (if false is returned the iterator will point again to the first item in the tree store). Of course, the most important part of this loop is the break statement, which abandons the loop leaving the iterator to point to the product category we were looking for.
+In the first line above we conveniently tuck away the model separating data store from the view (MVC). We use model to get to the starting iterator, either by Gtk::TreeStore#iter_first, or by Gtk::TreeStore#get_iter by supplying the top-level root path "0". Then comes a tricky while loop, where we need to check if the first iteration matches the selected category, and break out of the loop if it does, while on the other hand apply Gtk::TreeIter#next! at the end of the while loop. The API for Gtk::TreeIter#next! tells us that this command returns true if the iterator was successfully advanced to the next row((*on the same level,*))and false otherwise. In this case (if false is returned) the iterator will point again to the first item in the tree store. The important thing to realize about Gtk::TreeIter#next! is that it does not traverse the entire tree. Namely, it does not descend into any children rows!
 
 At this point we should have the iterator that points to our product category (the iter variable points to it), hence, under this product category we now create a new row for our new product. Adding the data to the new empty row is accomplished by:
 




ruby-gnome2-cvs メーリングリストの案内
Back to archive index