ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 3日 (水) 09:41:58 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees ------------------------- @@ -309,7 +309,7 @@ {{image_right("liststore-cdFunc.png")}} -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. +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 data in the model column, of which the renderer is made aware of by the column constructor, when in the form of hash argument the model column number for the((*:text*))attribute is passed to it, and (2) the second place is the column in the tree view, for which the cell renderer itself is responsible and has to update or copy over the value from the model, whenever this data there 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. When you become familiar with tree view, you should be able to obtain the same information by reading the following code snippet: