Print Page | Close Window

Small misbehavior in DatePicker/CalendarControl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=15245
Printed Date: 24 November 2024 at 11:16am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Small misbehavior in DatePicker/CalendarControl
Posted By: Marco1
Subject: Small misbehavior in DatePicker/CalendarControl
Date 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.




Replies:
Posted By: mdoubson
Date Posted: 25 September 2009 at 9:41am
You can click on week # instead of specific day

-------------
Mark Doubson, Ph.D.


Posted By: Marco1
Date Posted: 25 September 2009 at 11:26am
Originally posted by mdoubson mdoubson wrote:

You can click on week # instead of specific day
Yes, I know. But this isn't the desired behavior, cause it's inconsistent to the (well known) Outlook GUI - and is at least different from the week view.


Posted By: mdoubson
Date Posted: 25 September 2009 at 11:30am
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


-------------
Mark Doubson, Ph.D.


Posted By: dennisV
Date Posted: 28 September 2009 at 7:52am
Originally posted by mdoubson mdoubson wrote:

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


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)


Posted By: dennisV
Date Posted: 28 September 2009 at 8:45am
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)


Posted By: dennisV
Date Posted: 28 September 2009 at 9:19am
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)


Posted By: mdoubson
Date Posted: 28 September 2009 at 4:05pm
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();

if (ptrDatePickerConn)

m_Sink.Advise(ptrDatePickerConn, XTP_NC_DATEPICKERSELECTIONCHANGED, &CCalendarDemoView::OnDatePickerChanged); }

 


-------------
Mark Doubson, Ph.D.


Posted By: dennisV
Date Posted: 28 September 2009 at 5:02pm
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)


Posted By: mdoubson
Date Posted: 29 September 2009 at 7:21pm
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

-------------
Mark Doubson, Ph.D.


Posted By: Marco1
Date Posted: 30 September 2009 at 7:41am
Would be smart if you add a handy control option switch (eg. in CalendarController) to activate that behavior if needed...



Posted By: dennisV
Date Posted: 30 September 2009 at 8:07am
Originally posted by Marco1 Marco1 wrote:

Would be smart if you add a handy control option switch (eg. in CalendarController) to activate that behavior if needed...


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)


Posted By: mdoubson
Date Posted: 30 September 2009 at 7:59pm
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 - 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 - 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
 
 


-------------
Mark Doubson, Ph.D.


Posted By: Marco1
Date Posted: 01 October 2009 at 4:11am
Mark, well done! Works like a charm.
Hope, it'll make it in 13.2 final.

Thanx!



Posted By: dennisV
Date Posted: 01 October 2009 at 8:34am
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)


Posted By: mdoubson
Date Posted: 01 October 2009 at 9:20am

dennisV - you can at least try to run static app.

Yes - the code is in SVN


-------------
Mark Doubson, Ph.D.


Posted By: dennisV
Date Posted: 01 October 2009 at 9:27am
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)


Posted By: dennisV
Date Posted: 01 October 2009 at 4:52pm
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)


Posted By: mdoubson
Date Posted: 01 October 2009 at 5:07pm
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?

-------------
Mark Doubson, Ph.D.


Posted By: dennisV
Date Posted: 01 October 2009 at 5:17pm
Originally posted by mdoubson mdoubson wrote:

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?

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)


Posted By: mdoubson
Date Posted: 01 October 2009 at 7:20pm
Hi, dennisV - please get updates from same link and try now - https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar - 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 
 


-------------
Mark Doubson, Ph.D.


Posted By: dennisV
Date Posted: 02 October 2009 at 4:38am
It works great! Just what my users are asking for :) Thank you!

-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)


Posted By: mdoubson
Date Posted: 02 October 2009 at 9:49am
Good  - I add control for this flag in Options Pane in DatePicker group in updated static app and in sample code


-------------
Mark Doubson, Ph.D.


Posted By: dennisV
Date Posted: 02 October 2009 at 10:10am
Excellent, now I just need to wait for 13.2 to be released...

-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)


Posted By: jintian01
Date Posted: 10 December 2011 at 1:26am
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)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net