I have a problem with subclassing a widget, when I add new signals to
this widget. See this smal example:
require ‘gtk2’
class Box1 < Gtk::VBox
def initialize data
super false, 2
end
end
class Box2 < Gtk::VBox
type_register
signal_new(:changed, GLib::Signal::RUN_FIRST,
nil, GLib::Type[‘void’], String, Float)
def signal_do_changed foo, bla
end
def initialize data
super false, 2
end
end
b1 = Box1.new ‘foo’
b2 = Box2.new ‘foo’
It throwes the error:
det@datengrab:~/Desktop$ ruby test.rb
test.rb:18:in initialize': wrong number of arguments (2 for 0..1) (ArgumentError) from test.rb:18:ininitialize’
from test.rb:23:in new' from test.rb:23:in’
as long, as I add no new signal to the widget the call to super() works
like expected. With the new signal it fails. Can someone explain to me,
why?