ruby-****@sourc*****
ruby-****@sourc*****
2009年 2月 13日 (金) 12:28:01 JST
------------------------- REMOTE_ADDR = 74.15.84.244 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees ------------------------- @@ -131,7 +131,7 @@ However the most important difference is in how iterators and parent and child columns are handled. The first change that became an important feature in the ((*store*)) data initialization process was a new attribute called "product_type" in the GroceryItem class. This attribute decides whether a data item (a row, a record, or a tuple) is a product_category designated as the parent column in our data structure, or a grocery product which in our data structure is a child column of the product_category. -Hence, when we are creating rows we have to create a column of parents and a column of children. The two are created in a slightly different way. The first difference is in the argument to the row creation method Gtk::TreeStore#append(parent). Namely, if the argument here called parent is nil we are creating parent row, when it is a non-nil Gtk::TreeIter we are creating a child of the parent to which the Gtk::TreeIter attribute points. Gtk::TreeStore#append method returns an iterator which points to the newly created empty data item (row, record, or tuple). This iterator is then used to assign values to the columns in the empty row. We add three columns, hence thre lines with the method: Gtk::TreeStore#set_value(iter, column, value). Let's look at the code fragment that illustrates the above narative. +Hence, when we are creating rows we have to create a column of parents and a column of children. The two are created in a slightly different way. The first difference is in the argument to the row creation method Gtk::TreeStore#append(parent). Namely, if the argument here called parent is nil we are creating parent row, when it is a non-nil Gtk::TreeIter we are creating a child of the parent to which the Gtk::TreeIter attribute points. Gtk::TreeStore#append method returns an iterator which points to the newly created empty data item (row, record, or tuple). This iterator is then used to assign values to the columns in the empty row. We add three columns, hence three lines with the method: Gtk::TreeStore#set_value(iter, column, value). Let's look at the code fragment that illustrates the above narrative: # Add all of the products to the GtkListStore.