Small misbehavior in DatePicker/CalendarControl |
Post Reply |
Author | |
Marco1
Senior Member Joined: 16 January 2004 Location: Germany Status: Offline Points: 251 |
Post Options
Thanks(0)
Posted: 25 September 2009 at 8:35am |
There's a small misbehavior in the DatePicker linked to the CanlendarControl.
Steps to reproduce: - open CalendarDemo sample project - open the date picker bar - select week view (7 days) - click on a day in the date picker Problem: calandar view changes from week view to day view Correct: calandar view stays week view and calendar shows the week of the clicked day (verified in Outlook 2007) If you select work week view (5 days) - behavior is correctly !! Tested with MfC and 13.1 and the latest 13.2 beta. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You can click on week # instead of specific day
|
|
Marco1
Senior Member Joined: 16 January 2004 Location: Germany Status: Offline Points: 251 |
Post Options
Thanks(0)
|
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
This is better as your click on Day inside already loaded WeekView (if follow "Outlook mode") do nothing while Switch to DayView (or MultiDayView if you make more complcated selection (e.g. not continues) give you more details
Can Outlook show you smth like 3 columns: [Sep, 25], [Sep, 26], [Oct, 18]?
Not sure but we can and some clients happy with this feature
|
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
I have the same problem - users prefer for the view to stay "as-is" when they click on the date picker. Is there anything that can be overriden to fix this behavior? Thanks! |
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
After a bit of digging, I assume that this function needs to be overriden:
void CXTPCalendarController::OnEvent_DatePicker(XTP_NOTIFY_CODE Event, WPARAM wParam, LPARAM /*lParam*/) Not too bad, if that's all :) |
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
Actually overriding the thing is not as simple... too many private declarations. It''s all doable of course, but would've been better if it was made simpler ;)
|
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You don't need to overwrite smth - just connect to datepicker and react on notification:
void OnDatePickerChanged(XTP_NOTIFY_CODE Event, WPARAM wParam , LPARAM lParam);
void CCalendarDemoView::OnDatePickerChanged(XTP_NOTIFY_CODE Event, WPARAM wParam , LPARAM lParam) { if (XTP_NC_DATEPICKERSELECTIONCHANGED == Event) { do smth ... } ... }void CCalendarDemoView::OnInitialUpdate() {
..................................
CXTPNotifyConnection* ptrDatePickerConn =
((CMainFrame*) GetParentFrame())->m_dlgDatePicker.m_wndDatePicker.GetConnection(); m_Sink.Advise(ptrDatePickerConn, XTP_NC_DATEPICKERSELECTIONCHANGED, &CCalendarDemoView::OnDatePickerChanged); } |
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
Yes, that's exactly what I was looking for, thanks!
However, at this stage it's too late, because the view has already been changed to Day (if one date is selected). |
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
You can keep on app level some member of User Selected type (not Core-selected!) and switch back to same User Selected type BUT with new data range
|
|
Marco1
Senior Member Joined: 16 January 2004 Location: Germany Status: Offline Points: 251 |
Post Options
Thanks(0)
|
Would be smart if you add a handy control option switch (eg. in CalendarController) to activate that behavior if needed...
|
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
Yes, I agree with that too. But for now I guess the app has to take control of this. |
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
I add today flag CalendarControl.SwitchToDayViewIfPickedSingleDay for ocx
default - False
you can try it in my beta - https://forum.codejock.com/uploads/BetaOCX/CalendarBeta13-2.rar
and for MFC - BOOL CXTPCalendarControl::m_bSwitchToDayViewIfPickedSingleDay; (default - FALSE)
Try updated https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar (btw - there is style folder inside the rar and app connected to all existed styles like White, Aqua, Scenic and so on)
You can use non continue selection with False flag if use Control+Click on DatePicker - see snapshot where after Oct, 02 we have Oct, 28
|
|
Marco1
Senior Member Joined: 16 January 2004 Location: Germany Status: Offline Points: 251 |
Post Options
Thanks(0)
|
Mark, well done! Works like a charm.
Hope, it'll make it in 13.2 final. Thanx! |
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
I haven't tried it, because I can't put a beta version into a release, but if it works do you plan to include it in 13.2?
|
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
dennisV - you can at least try to run static app. Yes - the code is in SVN
|
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
Yep, I'll try it in a few hours and I'll let you know how it goes.
|
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
I've tried the static sample - it works well, except that in Full Week mode (with multicolumn turned off) and Month mode it doesn't work. I suppose that's because it's not finished yet, right?
Thanks! |
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Right - what do you expect for MonthView and for WeekView (non-multi-column case)? Switch to another month or week DatePicker selected single day belong to?
|
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
Yes, that would be consistent - keep whatever view the user is in and just update the dates to reflect the new selections. Thanks! |
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Hi, dennisV - please get updates from same link and try now - https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar
I add similar functionality with FALSE (default) flag for WeekView and MonthView - fast Week or Month selection.
I also add menu handler View - Just for Test in Demo app
which toggle flag bSwitchToDayViewIfPickedSingleDay and show Checked if flag TRUE
so you can check both functional cases in same app and same session
|
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
It works great! Just what my users are asking for :) Thank you!
|
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Good - I add control for this flag in Options Pane in DatePicker group in updated static app and in sample code
|
|
dennisV
Senior Member Joined: 07 October 2004 Location: Australia Status: Offline Points: 242 |
Post Options
Thanks(0)
|
Excellent, now I just need to wait for 13.2 to be released...
|
|
// W7 64 Ultimate SP1
// VS 2008 // CodeJock 16.2.3 (MFC) |
|
jintian01
Newbie Joined: 10 December 2011 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
hey. In XTP, I am a beginner.So I Have a question: How can I get this effect in my project? besides use OnCtlColor.What need I do?(The effect is in CalendarDemo project)
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |