开发者

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

开发者 https://www.devze.com 2023-02-08 06:30 出处:网络
I\'m trying to catch the click event on 开发者_StackOverflow社区a row For some reason this only works on double click.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消