No evt_tree_sel_changed with TR_MULTIPLE

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.

Hi Christian

Christian Schmidt wrote:

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.

I think it’s a wxWidgets bug:
http://trac.wxwidgets.org/ticket/9570

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.

The event type is an integer constant which uniquely identifies that
kind of event. In this case, you want Wx::EVT_COMMAND_TREE_SEL_CHANGED.

For reference, you can see the mapping of all event types to event
classes in lib/wx/classes/evthandler.rb

http://wxruby.rubyforge.org/svn/branches/wxruby_2_0_stable/lib/wx/classes/evthandler.rb

a