[ruby-gnome2-doc-cvs] [Hiki] create - tut-treeview-selection-handle

Back to archive index

ruby-****@sourc***** ruby-****@sourc*****
2003年 11月 19日 (水) 21:46:11 JST


-------------------------
REMOTE_ADDR = 64.30.138.196
REMOTE_HOST = 
        URL = http://ruby-gnome2.sourceforge.jp/?tut-treeview-selection-handle
-------------------------
= Handling Selections

One of the most basic features of a list or tree view is that rows can be selected or unselected. Selections are handled using the Gtk::TreeSelection object of a tree view. Every tree view automatically has a Gtk::TreeSelection associated with it, and you can get it using Gtk::TreeView#selection. Selections are handled completely on the tree view side, which means that the model knows nothing about which rows are selected or not. There is no particular reason why selection handling could not have been implemented with functions that access the tree view widget directly, but for reasons of API cleanliness and code clarity the Gtk+ developers decided to create this special GtkTreeSelection object that then internally deals with the tree view widget. 

There are three ways to deal with tree view selections: either you get a list of the currently selected rows whenever you need it, for example within a context menu function, or you keep track of all select and unselect actions and keep a list of the currently selected rows around for whenever you need them; as a last resort, you can also traverse your list or tree and check each single row for whether it is selected or not (which you need to do if you want all rows that are not selected for example).






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