From: Daniel Carrera Date: 2003-02-23T06:18:23+09:00 Subject: Re: [Q] TreeView in Ruby-Gnome2 On Sun, Feb 23, 2003 at 01:51:32AM +0900, Masao Mutoh wrote: > > A couple of questions: > > > > 1) When the user clicks on an entry in a TreeView widget, how can I find > > out which entry was clicked? > > ---------------------- > > def callback(widget, event) > > # Use 'event' to find which line was clicked? > > end > > > > tree_view.signal_connect("button_press_event") {|w, e| callback(w, e)} > > 1. Use Gtk::TreeView's "cursor-changed" signal. > tree_view.signal_connect("cursor-changed") do ... end > > 2. Use Gtk::TreeSelection's "changed" signal. > tree_view.selection.signal_connect("changed") do ... end > > > 2) How come TreeView does not have a "clicked" signal like buttons? > > I couldn't understand this sentence because of my poor english. > What's different from your 1st question? 1) The first question was not asking which signal I could use. I already know that "button_press_event" works. I want to know which entry was clicked. Here is an example: Suppose that I make a tree with the entries "Jeffrey", "Melissa" and "Sandy". I want to know whether the user clicked on "Jeffrey" or whether he clicked on "Melissa" or "Sandy". 1.b) What does Gtk::TreeSelection's "changed" signal do? 2) In the second question, I point out that: my_button.singal_connect("clicked") { ... } # Works tree_view.signal_connect("clicked") { ... } # Does not work. I was just wondering why. Thanks for your help. I appreciate it very much. -- Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137