[ruby-gnome2-doc-cvs] [Hiki] update - tut-treeview-model-data

Zurück zum Archiv-Index

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


-------------------------
REMOTE_ADDR = 200.216.151.125
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/en/?tut-treeview-model-data
-------------------------
+ {{link "tut-treeview-model", "tut-treeview-model", "tut-treeview", "tut-treeview-model-reference"}}
  = How Data is Organised in a Store
  
  A model (data store) has model columns and rows. While a tree view will display each row in the model as a row in the view, the model's columns are not to be confused with a view's columns. A model column represents a certain data field of an item that has a fixed data type. You need to know what kind of data you want to store when you create a list store or a tree store, as you can not add new fields later on.
  
  For example, we might want to display a list of files. We would create a list store with two fields: a field that stores the filename (ie. a string) and a field that stores the file size (ie. an integer). The filename would be stored in column 0 of the model, and the file size would be stored in column 1 of the model. For each file we would add a row to the list store, and set the row's fields to the filename and the file size.
  
  The Ruby Class (ie. Object, Integer, Float, String, Hash, Gdk::Pixbuf, etc.). is used to indicate what type of data is stored in a model column.
  
  Here is an example of how to create a list store:
  
   list_store = Gtk::ListStore.new(String, Integer)
  
  This creates a new list store with two columns. Column 0 stores a string and column 1 stores an integer for each row. At this point the model has no rows yet of course. Before we start to add rows, let's have a look at the different ways used to refer to a particular row.





ruby-gnome2-cvs メーリングリストの案内
Zurück zum Archiv-Index