Hi
I've been playing for a while with WxRuby and I just acn make the TreeCtrl event evt_tree_expanded or evt_tree_expanding please help me here is the code mi problem its at line 46:

require 'wx'
include Wx
class MyFrame < Frame
	def initialize
		super(nil,
		:title => "prueba"
		)
		@my_panel = Panel.new(self)
		@my_label = StaticText.new(@my_panel, 
		:label => "MY",
		:pos => [150, 25],
		:size => Wx::DEFAULT_SIZE)
		@my_textbox = TextCtrl.new(@my_panel,
		:name => "Default Textbox Value",
		:pos => [20, 20])
		@my_combo = Wx::ComboBox.new(@my_panel,
		:name => "Default Combo Text",
		:pos => [150, 25],
		:choices => ['Item 1', 'Item 2', 'Item 3'])
		@my_button = Button.new(@my_panel, -1, 'My Button Text')
		evt_button @my_button, :my_button_click
		@my_panel_sizer = BoxSizer.new(VERTICAL)
		@my_panel.set_sizer(@my_panel_sizer)
		@my_panel_sizer.add(@my_label, 0, GROW|ALL, 2)
		@my_panel_sizer.add(@my_textbox, 0, GROW|ALL, 2)
		@my_panel_sizer.add(@my_combo, 0, GROW|ALL, 2)
		@my_panel_sizer.add(@my_button, 0, GROW|ALL, 2)
		show()
	end
	def get_name(eve)
		@id = eve.get_item
		@text = @tree.get_item_text(@id)
	end
	def my_button_click(event)
		@dir_dialog = Dialog.new(nil,
		:size => [400, 400])
		@dir_view = GenericDirCtrl.new(@dir_dialog,
		:size => [390, 340],
		:dir => ENV["HOME"] )
		@dir_vsizer = VBoxSizer.new
		@dir_dialog.set_sizer(@dir_vsizer)
		@accept = Button.new(@dir_dialog,
		:label => "Accept",
		:id => ID_OK)
		@tree = @dir_view.get_tree_ctrl
		evt_tree_item_expanded @tree, :get_name 
		@dir_vsizer.add(@dir_view, 0, 2)
		@dir_vsizer.add(@accept, 0, GROW|ALL, 2)			
		case @dir_dialog.show_modal
		when ID_OK
			@tree_select = @tree.get_selection()
			@tree_text = @tree.get_item_text(@tree_select)
			#poner cheque por si no es carpeta mandarlo de regreso
			#llamarlo usando el metodo dir_button_click
			@my_label.label = @text
			@dir_text.clear
			@error_dialog = Dialog.new(nil,
			:title => "Error",
			:size => [500, 100])
			@error_text = StaticText.new(@error_dialog,
			:label => "You must chose a folder",
			:style => ALIGN_CENTRE)
			@ok_error = Button.new(@error_dialog,
			:id => ID_OK)
			@error_size = VBoxSizer.new
			@error_dialog.set_sizer(@error_size)
			@error_size.add(@error_text, 0, GROW|ALL, 2)
			@error_size.add(@ok_error, 0, GROW|ALL, 2)
			case @error_dialog.show_modal
			when ID_OK
			end
			end
		end
	end
end
class MyApp < App
	def on_init
		MyFrame.new
	end
end
MyApp.new.main_loop()

Is there a better way to get the name of the branch when expanded ? please help
Thank You

sorry for posting twice I dont know why it hapened but this is the good one the other one I would apreciate if someone told me how to delete it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.