How to know when a TreeView row is selected in Ruby GTK

513 views Asked by At

I'm trying to catch the click event on 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 ?

2

There are 2 answers

0
Nounou On BEST ANSWER

I would say : @tree.signal_connect("cursor-changed") { |w,e| selObj(w,e) }

0
ChrisPhoenix On

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.