ruby-****@sourc*****
ruby-****@sourc*****
2012年 10月 7日 (日) 01:37:37 JST
------------------------- REMOTE_ADDR = 184.145.80.187 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-trees ------------------------- @@ -886,9 +886,9 @@ But the most important changes for this "Multi-item Column" version program are tucked away in the ((*setup_tree_view*)) method, where we needed to replace the original column instantiation method which handled a single "Product" item with a number of different methods that now manage both text and image items in the same column. This also requires reordering of statements dictated first by the API, and second by the way we would like to arrange the order of items (ie text and images) in the Product column. For the API related reordering of code please check the listing and search for the comment (# PECULIARITY: ...). The ordering of image and text in the column deserves some more attention. If you didn't care weather image appeared before the string (text), you wouldn't have to replace the original Product column instantiation statement: - column = Gtk::TreeViewColumn.new("Product", renderer, 'text' => PRODUCT) + column = Gtk::TreeViewColumn.new("Product", renderer, :text => PRODUCT) -You could simply pack the "pixb_renderer" into it, after initialization in which the specified renderer is also set to take the first position in the left side of the in the cell (note that packing order can not alter this positional arrangement). We chose the other option, namely, to position the image before the text. This is why we have to manually build both renderers (one for the image and the other for text) and then pack them into a column in order we like! +You could simply pack the "pixb_renderer" into it, after initialization in which the specified renderer is also set to take the first position in the left side of the in the cell (note that packing order can not alter this positional arrangement, the text would remain to sit before the image in tree view column). We chose the other option, namely, to position the image before the text. This is why we have to manually build both renderers (one for the image and the other for text) and then pack them into a column in order we like! Yet another wrinkle in our column building process is handling the situations when image is not available. We chose to complain with an annoying ERROR image. This is done with the stock item as follows: