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.