[ruby-gnome2-doc-cvs] [Hiki] update - tut-treeview-renderer-types

アーカイブの一覧に戻る

ruby-****@sourc***** ruby-****@sourc*****
2004年 4月 3日 (土) 06:21:43 JST


-------------------------
REMOTE_ADDR = 200.216.151.125
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/en/?tut-treeview-renderer-types
-------------------------
+ {{link "tut-treeview-renderer-celldatafunc", "tut-treeview-renderer", "tut-treeview", "tut-treeview-renderer-example"}}
  = GtkCellRendererText and Integer, TrueClass and Float Types
  
  It has been said before that, when using attributes to connect data from the model to a cell renderer property, the data in the model column specified in Gtk::TreeView#add_attributes must always be of the same type as the data type that the property requires.
  
  This is usually true, but there is an exception: if you add a text cell renderer's "text" property to a model column, the model column does not need to be a String, it can also be one of several other classes, e.g. TrueClass, Integer, FixNum, or Float. The text cell renderer will automatically display the values of these types correctly in the tree view. For example:
  
    list = Gtk::ListStore.new(String, Integer)
  
    renderer = Gtk::CellRenderer.new
    col = Gtk::TreeViewColumn.new("Age", renderer, :text => 1)
  
  Even though the "text" property would require a string value, we use a model column of an integer type when setting attributes. The integer will then automatically be converted into a string before the cell renderer property is set.
  
  If you are using a Float class, there is no way to tell the text cell renderer how many digits after the floating point (or comma) should be rendered. If you only want a certain amount of digits after the point/comma, you will need to use a ((<cell data function|tut-treeview-renderer-celldatafunc>)).





ruby-gnome2-cvs メーリングリストの案内
アーカイブの一覧に戻る