How to know when a TreeView row is selected in Ruby GTK
I'm trying to catch the click event on 开发者_StackOverflow社区a row
For some reason this only works on double click.
@tree.signal_connect("row-activated") do |view, path, column|
puts "Row #{path.to_str} was clicked!"
end
How can I catch just a single click ?
I would say :
@tree.signal_connect("cursor-changed") { |w,e| selObj(w,e) }
row-activated is the double-click signal. Think of "activated" as "user wants to edit this or do something with it." If you're using VisualRuby, then any GTK object with a show() method should be editable - it'll pop up its window when double-clicked.
I agree with the answer above - a single click changes the cursor, so use cursor-changed.
精彩评论