I trying to make a Dialog that include a DatePickerCtrl on my gentoo linux box. I get the following error /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:478:in `const_missing'': uninitialized constant PortfolioDialog::DatePickerCtrl (NameError) My application use ActiveRecord, thats why the error is from activesupport. gem list says wxruby (1.9.9, 1.9.8) Should DatePickerCtrl work in this version?
Hello Svend, 2009/11/5 Svend Haugaard S?rensen <shs at demosophia.net>> I trying to make a Dialog that include a DatePickerCtrl on my gentoo > linux box. > > I get the following error > > /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:478:in > `const_missing'': uninitialized constant PortfolioDialog::DatePickerCtrl > (NameError) > > My application use ActiveRecord, thats why the error is from > activesupport. > > gem list says > wxruby (1.9.9, 1.9.8) >1.9.8 and 1.9.9 are old versions, you should use 2.0.1, as it is the newest, however the wxDatePickerCtrl is in 1.9.9 and 1.9.8. The problem is, is that ActiveSupport is trying to check for a Constant, that does not exist. You need to use Wx::DatePickerCtrl in order to make it work, unless you include Wx in PortfolioDialog class. EG: class PortfolioDialog < Wx::Dialog def initialize super @dpc = Wx::DatePickerCtrl.new end end Or: class PortfolioDialog < Wx::Dialog include Wx def initialize super @dpc = DatePickerCtrl.new end end Or module Wx class PortfolioDialog < Dialog def initialize super @dpc = DatePickerCtrl.new end end end The last method I would not use, as that pollutes the Wx namespace. But the point being, that when you subclass from a wxRuby class, it does not automatically inherit the Wx namespace. You need to either explicitly define it, include it, or define your class under the Wx namespace, in order to avoid having to use the Wx namespace in pre-pending of class definitions. hth, Mario> Should DatePickerCtrl work in this version? > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20091106/76b424da/attachment-0001.html>
Svend Haugaard Sørensen
2009-Nov-06 10:07 UTC
[wxruby-users] DatePickerCtrl uninitialized constant
On Fri, 6 Nov 2009 02:40:47 -0500 Mario Steele <mario at ruby-im.net> wrote:> Hello Svend, > > 2009/11/5 Svend Haugaard S?rensen <shs at demosophia.net> > > > I trying to make a Dialog that include a DatePickerCtrl on my gentoo > > linux box. > > > > I get the following error > > > > /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:478:in > > `const_missing'': uninitialized constant > > PortfolioDialog::DatePickerCtrl (NameError) > > > > My application use ActiveRecord, thats why the error is from > > activesupport. > > > > gem list says > > wxruby (1.9.9, 1.9.8) > > > > 1.9.8 and 1.9.9 are old versions, you should use 2.0.1, as it is the > newest, however the wxDatePickerCtrl is in 1.9.9 and 1.9.8. The > problem is, is that ActiveSupport is trying to check for a Constant, > that does not exist. You need to use Wx::DatePickerCtrl in order to > make it work, unless you include Wx in PortfolioDialog class. >I have have a ''include Wx'' just after ''require "wx"'' in my program. If I use @buy_date=Wx::DatePickerCtrl.new(self,-1) the error change to /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:263:in `load_missing_constant'': uninitialized constant Wxruby2::DatePickerCtrl (NameError) I tried to make a ''gem update wxruby'' and that installed the 1.9.9 version. And it didn''t remove the error.