[wxruby-users] No evt_tree_sel_changed with TR_MULTIPLE

Christian Schmidt lists at ruby-forum.com
Mon Mar 23 18:41:40 EDT 2009


Hi,

I have a problem with evt_tree_sel_changed not getting fired when I'm
selecting a node programatically on a TreeCtrl with the TR_MULTIPLE flag
set.
Is this intended?

I've got some code depending on the evt-handler.
Can I work around this? I thought of EvtHandler#add_pending_event but I
can't figure out the correct commandType parameter to TreeEvent#new.

Here's a sample app, that demonstrates the above:

require 'wx'
include Wx

class MyFrame < Frame
  def initialize
    super nil, -1, "no sel event"

    @tree = TreeCtrl.new(self, -1, :style => TR_MULTIPLE)

    evt_tree_sel_changed(@tree) do |e|
      puts "sel changed #{@tree.get_item_text(e.get_item)}"
    end

    @root = @tree.add_root 'root', 0
    child = @tree.insert_item @root, 0, 'child'
    @tree.expand @root

    @tree.select_item child
  end
end

class MyApp < App
    def on_init
         f =  MyFrame.new
   f.show
    end
end

MyApp.new.main_loop


Thanks in advance,
Christian.

Attachments:
http://www.ruby-forum.com/attachment/3480/tree_no_selection_evt.rb

-- 
Posted via http://www.ruby-forum.com/.


More information about the wxruby-users mailing list