Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Small misbehavior in DatePicker/CalendarControl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Small misbehavior in DatePicker/CalendarControl

 Post Reply Post Reply
Author
Message
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post Topic: Small misbehavior in DatePicker/CalendarControl
    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.

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 25 September 2009 at 9:41am
You can click on week # instead of specific day
Back to Top
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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); }

 
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post 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...

Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 30 September 2009 at 7:59pm
I add today flag CalendarControl.SwitchToDayViewIfPickedSingleDay for ocx
default - False
 
 
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
 
 
Back to Top
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2009 at 4:11am
Mark, well done! Works like a charm.
Hope, it'll make it in 13.2 final.

Thanx!

Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 01 October 2009 at 9:20am

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

Yes - the code is in SVN
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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
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 
 
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
jintian01 View Drop Down
Newbie
Newbie
Avatar

Joined: 10 December 2011
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote jintian01 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.