Hi, I'm trying to learn wxRuby. This is program: require 'wx' include Wx class MyFrame < Frame def initialize super(nil,-1,"Mi primera ventana Wx!") @panel = Panel.new(self) @lbl1 = StaticText.new(@panel,-1,"Label") @text1 = TextCtrl.new(@panel,-1,"Text Value") @combo =ComboBox.new(@panel,-1,"Combo Text") @button =Button.new(@panel,-1,"Submit") #layout @sizer = BoxSizer.new(VERTICAL) @panel.set_sizer(@sizer) evt_button(@my_button.get_id()) { |event| my_button_click(event)} @sizer.add(@lbl1,0, GROW|ALL,2) @sizer.add(@text1,0, GROW|ALL,2) @sizer.add(@combo,0, GROW|ALL,2) @sizer.add(@button,0, GROW|ALL,2) show() end def my_button_click(event) #añádir codigo puts "Presionado" end end class Myapp < App def on_init MyFrame.new end end a= Myapp.new a.main_loop() When I run this, I get an illegal operation! I am using wxRuby 2.0.1, Ruby 1.8 (one click installer version) and windows xp. Thanks for any info. -- Posted via http://www.ruby-forum.com/. _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
tuti plain
2010-Mar-30 17:14 UTC
[wxruby-users] My first wxRuby app doesn''t work, please help!
Never mind. My constructors were all wrong. -- Posted via http://www.ruby-forum.com/.
Adi Mou
2010-May-24 21:52 UTC
[wxruby-users] My first wxRuby app doesn''t work, please help!
Hi, On error in your code : evt_button(@my_button.get_id()) { |event| my_button_click(event)} The correct : evt_button(@button.get_id()) { |event| my_button_click(event)} Good luck -- Posted via http://www.ruby-forum.com/.