ruby-****@sourc*****
ruby-****@sourc*****
2012年 8月 17日 (金) 03:17:31 JST
------------------------- REMOTE_ADDR = 70.49.49.99 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-parts ------------------------- @@ -266,7 +266,7 @@ column = Gtk::TreeViewColumn.new("Buy", renderer, {:text => 3, :foreground => 4}) -Particularly misleading in the above code and in the API documentation is the part (if read inattentively) suggesting that the hash of attributes may be used to set the attributes to their respective values. That may have been an original Gtk GUI developer's goal that never materialized, or perhaps not since the way it works now is rather useful though undoubtedly very convoluted. Namely, one may incorrectly conclude that in the above code we could set the foreground colour directly when creating the view column. This, however, is not the case, namely all attributes in the hash can only be assigned their respective column numbers in the tree view, which with the exception of :text attribute, is a rather ridiculous thing in most everyday situations. Unless you need to design tree views that look like file browser, where each row is rendered in alternate colours, you can simply ignore the sophistication of storing attribute values in a list or tree models along with the user d ata. (We will however look at this more closely in the following pages.) +Particularly misleading in the above code and in the API documentation is the part (if read inattentively) suggesting that the hash of attributes may be used to set the attributes to their respective values. That may have been an original Gtk GUI developer's goal that never materialized, or perhaps not, since the way it works now is rather useful though undoubtedly very convoluted. Namely, one may incorrectly conclude that in the above code we could set the foreground colour directly when creating the view column. This, however, is not the case, namely all attributes in the hash can only be assigned their respective column numbers in the tree view, which with the exception of :text attribute, is a rather ridiculous thing in most everyday situations. Unless you need to design tree views that look like file browser, where each row is rendered in alternate colours, you can simply ignore the sophistication of storing attribute values in a list or tree models along with the user data. (We will however look at this more closely in the following pages.) #-------