ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 3日 (水) 09:54:08 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 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. +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. When it does, the background of the column is set to red, otherwise the nil value forces the background to revert to default. 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 to copy over the value from the model for every row it renders. 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: