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

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 9月 24日 (月) 01:45:08 JST


-------------------------
REMOTE_ADDR = 184.145.80.187
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees
-------------------------
@@ -285,8 +285,8 @@
 
 Not surprisingly all the work to set the renderer's background property is done in the code block associated with the ((*set_cell_data_func*)) method. Note that this method is passed a cell renderer, which associates it with this particular renderer which in turn is mapped to a tree view column via the column constructor (Gtk::TreeViewColumn.new), and subsequently by the Gtk::TreeView#append_column(column) statement to the tree view; so all ((*render, column,*)) and the((*tree view*))are all connected (i.e. related.) The block associated with the "cell data function" is executed for every row for that particular view column. However, what may surprise a novice GTK+ programmer is that there is no((*:background*))attribute present in the hash of attribute name/value pairs in the constructor for the column!
 
+ column   = Gtk::TreeViewColumn.new("Buy", renderer,  :text => BUY_IT)
 
-
 {{br}}
 {{br}}
 
@@ -298,7 +298,7 @@
 
 In the first ("Grocery List") program, in the code block associated with((*set_cell_data_func*))method we are checking if "Buy" column contains TRUE. If it does, the background of the column is set to red. Note, that cell renderer is aware of two places where the "Buy" column data exists. (1) The first place is the persistent model column of which the renderer was made aware of by the column constructor, which in a form of hash argument conveyed to it the model column number for the((*:text*))attribute (i.e. for the value of "Buy" column in a model row), and (2) the second place is the view column in the tree view, for which cell renderer itself is responsible to update, whenever this column's data in the model changes.
 
-Obviously, in the tree model there are as many different "Buy" column values as there are rows, and each value in the model has a corresponding value on the display or in the tree view. Depending on the value in each row, the renderer has to render the background either white or red. This happens in the((*set_cell_data_func*))method which is run for every row in the model. All that was just said can be read from the following code snippet:
+Obviously, in the tree model there are as many different "Buy" column values as there are rows, and each value in the model has a corresponding value on the display or in the tree view. Depending on the value in each row, the renderer has to render the background either white or red. This happens in the((*set_cell_data_func*))method which is run for every row in the model. When you become familiar with tree view, you should be able to obtain the same information by reading  the following code snippet:
 
  renderer = Gtk::CellRendererText.new
  column   = Gtk::TreeViewColumn.new("Buy", renderer,  :text => BUY_IT)




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