--UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Feb 24, 2003 at 10:37:43AM +0900, mutoh / highway.ne.jp wrote: > >> tree_view.signal_connect('cursor-changed') do |e| > >> iter ree_view.selection.selected > >> end > > > >I've been trying to Gtk::TreeSelection this all weekend. I doesn't >work. > >Try it! > > Could you send your test code here? > How doesn't it work? It doesn't work in the sense that the 'iter' returned does not correspond to any of the entries in the list structure. Sample code is attached. -- Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137 --UugvWAfsgieZRqgk Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="test.rb" require 'gtk2' Gtk.init # # Create a window. # window tk::Window.new( Gtk::Window::TOPLEVEL ) window.set_title( "AddressBook" ) window.set_border_width( 10 ) window.signal_connect( "destroy" ) { Gtk.main_quit } # # List. # list_store tk::ListStore.new( String ) tree_view tk::TreeView.new(list_store) render tk::CellRendererText.new column tk::TreeViewColumn.new("Contacts", render, {:text 0}) tree_view.append_column( column ) jeffrey ist_store.append.set_value( 0, "Jeffrey") melissa ist_store.append.set_value( 0, "Melissa") sandy ist_store.append.set_value( 0, "Sandy") tree_view.signal_connect('cursor-changed') do iter ree_view.selection.selected if iter jeffrey puts "Jeffrey" elsif iter melissa puts "Melissa" elsif iter sandy puts "Sandy" else puts "No one" end end window.add( tree_view ) # # Start the program. # window.show_all Gtk.main --UugvWAfsgieZRqgk--