From: Mark D. <mar...@zn...> - 2006-09-29 01:25:33
|
Hi, The particular constant 'wxDefaultDateTime' does not appear to be exported. Even if wxDefaultDateTime were exported, if you used it in the constructor of your Wx::DatePickerCtrl, the date would be set to the current date. (Well, as it isn't exported this can't be tested, but so the docs say). On wxMSW, if you use the wxDP_ALLOWNONE flag and have the control apparantly toggled 'off', ->GetValue() still returns the date value from the control. This is a wxWidgets 'feature' rather than anything to do with wxPerl I think. It seems to me that you'll get the most satisfactory interface if you use a separate check box you can actually check the state of to enable / disable a dropdown DatePickerCtrl. Use 'Wx::DateTime->new()' instead of wxDefaultDateTime in the constructor to get 'today' as an initial value. I assume you were just asking about the specific constant wxDefaultDateTime, but for anyone interested - for general examples on how to use controls, load constants, where you need to 'use Wx::SomethingElse' etc. are you aware of the wxDemo ? http://search.cpan.org/~mbarbon/Wx-Demo-0.02/ Browsing the module code of the demo is currently the best 'reference' available I think. To find out which constants are actually exported by wxPerl, you can check the text of the Wx_Exp.pm module in your Wx installation. A tip on the DateTime stuff in general - choose from the vast array of Date Time modules on CPAN for any of your date operations or calculations - just use the wxWidgets stuff for display. I often get carried away using wxWidgets functions just because they are in the toolkit when really there are much better solutions on CPAN. Best Regards Mark Edward Heil wrote: > Hullo -- > > We've been using our own hand-rolled datepicker control, which pulls up > a dialog with a Wx::Calendar on it. > > Just the thing to replace with a Wx::DatePickerCtrl now that the real > Wx::DatePickerCtrl is available! > > So I've been trying to press Wx::DatePickerCtrl into service. I've been > having some problems. > > First off, I can't 'use Wx::DatePickerCtrl' -- though if I 'use > Wx::Calendar' I get Wx::DatePickerCtrl loaded as a side effect. This > is pretty counterintuitive. > > I also am not able to subclass it (use base > qw(Wx::DatePickerCtrl))without doing a 'use Wx::Calendar' first to get > Wx::DatePickerCtrl loaded, which also took me quite a while to figure out. > > (Actually I just figured those two out while writing this message, while > trying to put together a tiny app to demonstrate the problems I was > having with it.) > > The one problem I still haven't been able to figure out is how to import > the constant wxDefaultDateTime so I can test whether the datepicker has > a null date (having passed it the style DP_ALLOWNONE). Where is that > constant exported from? How can I get to it? > > sorry for this stream-of-consciousness-like email. I've been wrestling > with this stuff with a sleep deficit, which has probably made me a > little stupider about it than I might have been. If I've been unclear > on anything let me know. > > Versions involved: wxPerl 0.57 on OS X. built with wxWidgets 2.6.3. > > Any insight on the wxDateTime constant? > > Thanks very much, > > Ed Heil > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > wxperl-users mailing list > wxp...@li... > https://lists.sourceforge.net/lists/listinfo/wxperl-users |