DatePickerCtrl uninitialized constant

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 [email protected]

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

On Fri, 6 Nov 2009 02:40:47 -0500
Mario S. [email protected] wrote:

`const_missing’: uninitialized constant
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.