Forum: wxRuby wxDatePickerCtrl

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fabio P. (Guest)
on 2008-12-05 23:54
(Received via mailing list)
Ciao Alex,

is there any chance to have wxDatePickerCtrl support in wxRuby?

cheers,

bio.
Alex F. (Guest)
on 2008-12-06 00:02
(Received via mailing list)
Fabio P. wrote:
> is there any chance to have wxDatePickerCtrl support in wxRuby?

Yeah, I can have a look at it; please file a Feature Request to track
it.

I've tried adding the class before and ran into problems. But classes
that were previously difficult can often be solved now as the wrappings
generally have improved.

alex
Fabio P. (Guest)
on 2008-12-06 00:39
(Received via mailing list)
> Yeah, I can have a look at it; please file a Feature Request to track it.


done!

thank you.
Rooby N. (Guest)
on 2009-02-16 21:07
May I ask if the wxDatePickerCtrl is now supported in the latest wxRuby?

If so how would you obtain a value from it?  Many thanks :)
Chauk-Mean P. (Guest)
on 2009-02-17 10:57
(Received via mailing list)
Hi,

2009/2/16 Rooby N. <removed_email_address@domain.invalid>:
> May I ask if the wxDatePickerCtrl is now supported in the latest wxRuby?

Yes it is supported.

> If so how would you obtain a value from it?  Many thanks :)

This is documented at
http://wxruby.rubyforge.org/doc/datepickerctrl.html


Chauk-Mean.
Rooby N. (Guest)
on 2009-02-17 13:56
> Yes it is supported.

Thank you for that, great news.

> This is documented at
> http://wxruby.rubyforge.org/doc/datepickerctrl.html

Sorry I should have mentioned that I have already looked at this page
and have tried some of the methods but without success, hence my asking
about the widget being supported. Currently, id_datectrl_from.get_value
produces the following:

#<SWIG::TYPE_p_wxDateTime:0x7f0fdf7e70c0>

Is this what you would expect, and if so, how would you obtain a date
value from it?

One thing mentioned on this page is "It is only available if
USE_DATEPICKCTRL is set to $1$" - how would I go about checking or
implementing this?
Alex F. (Guest)
on 2009-02-17 15:17
(Received via mailing list)
Rooby N. wrote:
> Sorry I should have mentioned that I have already looked at this page
> and have tried some of the methods but without success, hence my asking
> about the widget being supported. Currently, id_datectrl_from.get_value
> produces the following:
>
> #<SWIG::TYPE_p_wxDateTime:0x7f0fdf7e70c0>
>
> Is this what you would expect, and if so, how would you obtain a date
> value from it?
>

No, it's a bug. Thanks for the report. It should return a ruby Time
object (as other classes eg CalendarCtrl do). Ufnortunately you won't be
able to do anything useful with the current return value.

It should be easy to fix - the SWIG typemap for wxDateTime that's
applied to wxDateTime& needs to be applied to wxDateTime. For some
reason wxWidgets has one class return an C++ object and the other a C++
reference.

> One thing mentioned on this page is "It is only available if
> USE_DATEPICKCTRL is set to $1$" - how would I go about checking or
> implementing this?

Ignore this.
Rooby N. (Guest)
on 2009-02-17 15:45
> No, it's a bug. Thanks for the report.

Glad to be of help!

> It should be easy to fix - the SWIG typemap for wxDateTime that's
> applied to wxDateTime& needs to be applied to wxDateTime. For some
> reason wxWidgets has one class return an C++ object and the other a C++
> reference.

Er, yes, that's just what I thought!  Anyway I hope it's easy to fix and
I look forward to being able to use the datepicker shortly.
Rooby N. (Guest)
on 2009-03-06 15:16
Does anyone know if there is any way to show the date in a
wxDatePickerCtrl in UK date format (dd/mm/yyyy) rather than the default
mm/dd/yyyy?
Alex F. (Guest)
on 2009-03-06 17:18
(Received via mailing list)
Rooby N. wrote:
> Does anyone know if there is any way to show the date in a
> wxDatePickerCtrl in UK date format (dd/mm/yyyy) rather than the default
> mm/dd/yyyy?
>
Try adding this somewhere early in your App.run / App#on_init code:

Wx::App.run do
  Wx::Locale.locale = 'en_GB'
  ...
end

a
Rooby N. (Guest)
on 2009-03-06 17:26
Success.  Many thanks for your help, and also for recently sorting out
the bug with the Date Picker.
This topic is locked and can not be replied to.