From: Edward H. <ed...@do...> - 2006-09-28 21:50:43
|
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 |
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 |
From: Edward H. <ed...@do...> - 2006-09-29 03:03:45
|
Thank you, Mark! I will be keeping a copy of your email handy for reference for future situations like this. Regarding one of the things you mentioned -- Mark Dootson wrote: > 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. > If I'm understanding you correctly, wxDP_ALLOWNONE is essentially nonfunctional in wxMSW? The only way to allow null dates and have it work in wxMSW is to roll your own external checkbox to indicate whether or not the date is null? And it's an upstream wxWidgets issue, not a wxPerl one? If that is the case we might be better off going back to our own roll-your-own date solution involving a TextCtrl and a button that triggers a picker dialog with a Wx::Calendar on it. In any case, I appreciate your message; you gave me a fish *and* taught me how to fish. :) Best, Ed |
From: Mark D. <mar...@zn...> - 2006-09-29 18:29:03
|
Edward Heil wrote: > If I'm understanding you correctly, wxDP_ALLOWNONE is essentially > nonfunctional in wxMSW? The only way to allow null dates and have it > work in wxMSW is to roll your own external checkbox to indicate whether > or not the date is null? And it's an upstream wxWidgets issue, not a > wxPerl one? > > If that is the case we might be better off going back to our own > roll-your-own date solution involving a TextCtrl and a button that > triggers a picker dialog with a Wx::Calendar on it. > I think so, yes. wxDP_ALLOWNONE flag presents a checkbox that allows the user to 'disable' the datepicker control. But I can't see any way you can determine from your code whether or not that check box is selected. Perhaps someone else with more DatePicker experience can confirm? Regards Mark |