[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tut-gtk2-treev-addrnhs

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2012年 8月 26日 (日) 05:37:16 JST


-------------------------
REMOTE_ADDR = 70.49.49.99
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/hiki.cgi?tut-gtk2-treev-addrnhs
-------------------------
@@ -587,7 +587,7 @@
 
 {{image_right("combo-box.png")}}
 
-Since combo boxes provide their own methods to manage additions and removal of their selectable elements, it is not immediately apparent that combo boxes are related to the tree model. Depending on how a combo box is initialized (either with Gtk::ComboBox.new(is_text_only = true) or with Gtk::ComboBox.new(model)), it can be used in two different ways, either with a custom Gtk::TreeModel or with a default model with only a single column of settings. In our example program (selections.rb) above a new Gtk::ComboBox was created with Gtk::ComboBox.new(is_text_only = true), which creates a specialized combo box that contains only one column of strings. This is simply a convenience widget, since it too internally is managed with Gtk::TreeModel. It consists of the methods Gtk::ComboBox#append_text, Gtk::ComboBox#insert_text, Gtk::ComboBox#prepend_text, Gtk::ComboBox#remove_text and Gtk::ComboBox#active_text to bypass the complexity of the tree model.
+Since combo boxes provide their own methods to manage additions and removal of their selectable elements, it is not immediately apparent that combo boxes are related to the tree model. Depending on how a combo box is initialized (either with Gtk::ComboBox.new(is_text_only = true) or with Gtk::ComboBox.new(model)), it can be used in two different ways, either with a custom Gtk::TreeModel or with a default model with only a single column of settings. In our example program (tview-selections.rb) above a new Gtk::ComboBox was created with Gtk::ComboBox.new(is_text_only = true), which creates a specialized combo box that contains only one column of strings. This is simply a convenience widget, since it too internally is managed with Gtk::TreeModel. It consists of the methods Gtk::ComboBox#append_text, Gtk::ComboBox#insert_text, Gtk::ComboBox#prepend_text, Gtk::ComboBox#remove_text and Gtk::ComboBox#active_text to bypass the complexity of the tree model.
 
 But combo boxes can also be created with Gtk::ComboBox.new(model), requiring  you to create a tree model to hold the selections, which by the way can have multiple columns. This does not assume anything about the content of the tree model or the types of each column. Adding and removing elements to a combo box created with Gtk::ComboBox.new(model) is handled entirely with the tree model. As explained in the API documentation, the Gtk::ComboBox uses the model-view pattern; the list of valid choices is specified in the form of a tree model, and the display of the choices can be adapted to the data in the model by using cell renderers, as you would in a tree view. This is possible since Gtk::ComboBox implements the Gtk::CellLayout interface. The tree model holding the valid choices is not restricted to a flat list, it can be a real tree, and the popup will reflect the tree structure.
 




ruby-gnome2-cvs メーリングリストの案内
Back to archive index