I finally got my CheckListBoxes under control (thanks Alex& Phil) and have moved on to tackling the CalendatCtrl. This one seemed pretty easy when I was reading through the documentation but I cannot retrieve the selected date. I have the following code: def initialize... ... @calendar = panel.add(Wx::CalendarCtrl[]) panel.add(Wx::Button[:label => ''test'']) do |@button| listen(:button, @button, :on_b) end end def on_b date = @calendar.date puts date end And I am getting the following error(s): c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accessors.rb:53:in ` initialize'': wrong number of arguments (6 for 0) (ArgumentError) from c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso rs.rb:53:in `new'' from c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso rs.rb:53:in `get_date'' from c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso rs.rb:53:in `send'' from c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso rs.rb:53:in `method_missing'' from C:/ruby/work/wxtest/test.rb:73:in `on_b'' .... .... I went looking in accessors.rb to see if I could figure anything out but I got nothing. meth seems to be fine (get_date), but *args is [0 1 2 3 4 5]. That part looked odd to me, that it had 6 args (which is the error), but I''m not sure where they are coming from. Any ideas? thanks, -alex c.
Alex Ciarlillo wrote:> I finally got my CheckListBoxes under control (thanks Alex& Phil) and > have moved on to tackling the CalendatCtrl. This one seemed pretty easy > when I was reading through the documentation but I cannot retrieve the > selected date. >I haven''t looked at this before, but does it help if you add require ''date'' at the top of your script?> def initialize... > ... > @calendar = panel.add(Wx::CalendarCtrl[]) >[ You can just say panel.add(Wx::CalendarCtrl) ]> I went looking in accessors.rb to see if I could figure anything out but > I got nothing. meth seems to be fine (get_date), but *args is [0 1 2 3 4 > 5]. That part looked odd to me, that it had 6 args (which is the error), > but I''m not sure where they are coming from. >I think it''s coming from one of SWIG''s internal typemaps between WxWidgets and Ruby classes. In this case it should be converting wxDateTime to a ruby DateTime object. But I''m not sure if it''s quite right - let us know how it goes. alex
Hi Alex, Could you possibly post your entire file? I''ve pulled out what you have and am unable to reproduce your error (what platform are you on, btw?) Thanks, Phil On 4/3/07, Alex Ciarlillo <ac251404 at ohio.edu> wrote:> I finally got my CheckListBoxes under control (thanks Alex& Phil) and > have moved on to tackling the CalendatCtrl. This one seemed pretty easy > when I was reading through the documentation but I cannot retrieve the > selected date. I have the following code: > > def initialize... > ... > @calendar = panel.add(Wx::CalendarCtrl[]) > panel.add(Wx::Button[:label => ''test'']) do |@button| > listen(:button, @button, :on_b) > end > end > > def on_b > date = @calendar.date > puts date > end > > > And I am getting the following error(s): > > c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accessors.rb:53:in > ` > initialize'': wrong number of arguments (6 for 0) (ArgumentError) > from > c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso > rs.rb:53:in `new'' > from > c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso > rs.rb:53:in `get_date'' > from > c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso > rs.rb:53:in `send'' > from > c:/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.14/lib/wx_sugar/accesso > rs.rb:53:in `method_missing'' > from C:/ruby/work/wxtest/test.rb:73:in `on_b'' > .... > .... > > > I went looking in accessors.rb to see if I could figure anything out but > I got nothing. meth seems to be fine (get_date), but *args is [0 1 2 3 4 > 5]. That part looked odd to me, that it had 6 args (which is the error), > but I''m not sure where they are coming from. > > Any ideas? > > thanks, > -alex c. > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-- -Phil <><