mcorino / wxRuby3

Ruby Cross-Platform GUI extension
https://mcorino.github.io/wxRuby3/
MIT License
76 stars 6 forks source link

Wx::CalendarCtrl doesn't accept Wx::DefaultDateTime #143

Closed Randalphwa closed 1 year ago

Randalphwa commented 1 year ago

The documentation for Wx::CalendarCtrl states in the create function that I can use Wx::DefaultDateTime for the date (several other methods on this page also indicate this as the default). However, when I create the code:

    @calendar = Wx::CalendarCtrl.new(self, Wx::ID_ANY, Wx::DefaultDateTime,
      Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE, Wx::CAL_SHOW_HOLIDAYS)

I get an error from Ruby:

wxruby3-0.9.0.pre.rc.3-x64-mingw-ucrt/lib/wx/global_const.rb:47:in `const_missing':
    uninitialized constant Wx::DefaultDateTime (NameError)

It does work if instead I use DateTime.now instead of Wx::DefaultDateTime, but that's not specifically documented. So, I'm not sure if it's a documentation glitch and Wx::DefaultDateTime really isn't supported, or the wxRuby3 implementation is missing the constant.

mcorino commented 1 year ago

Fixed. Be aware wxDefaultDateTime is Wx::DEFAULT_DATE_TIME in wxRuby. Also this constant has value 'nil' in wxRuby so you could also simply use that.

mcorino commented 1 year ago

I made Wx::DefaultDateTime available as well (I don't think that is the correct consistent naming but the docs refer to it in several places).