Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Week view mode title
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Week view mode title

 Post Reply Post Reply
Author
Message
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post Topic: Week view mode title
    Posted: 18 June 2009 at 2:49am
In week view the title has year if different from the current... except when dates cross 2 months, in this case the year is not present.
(support advised before beta available)
VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com

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

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 21 June 2009 at 3:56pm
As near as I can tell something in the "StripFormat" method is clobbering the format string.

This method builds the format strings:

CString CXTPCalendarCaptionBarTheme::CDateLabelPart::_FormatDate(COleDateTime dtDay1, COleDateTime dtDay2, BOOL bShowMonthDay)

You'll see strFormat2 is made from strFormat1 here:

CString strFormat2(strFormat1); << these should be 2 distinct CStrings now. Instead as you'll see code acts like it's one

Removing 'y' from strFormat1 ALSO removes it from strFormat2, clobbering it. This is a minor display bug, but it also indicates something seriously wrong going on. Maybe it's some simple thing but I don't know why it's happening. If you want to fix it temporarily while CJ engineers go mad, stick the 'y' back on strFormat2.

approximately line 1676 in XTPCalendarCaptionBarControl.cpp

strFormat1 = CXTPCalendarUtils::RemoveFormatPart(strFormat1,  _T('y'));
strFormat2.Append(_T("yyyy")); // WHAT!??


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: 22 June 2009 at 9:43pm
Try to use pDayView->SetDayHeaderFormat(_T("%a, %b %d")); or any c-style day format - it give you full control on Day Header titles without stripping something in old code in DayView and in multi-column week / work week modes.
You can also try new mode GetCalendarCtrl().m_bFullDateMode = TRUE;
 
a small comment to prev post:
CString strFormat2(strFormat1); //this is 2 distinct CStrings now - Surprise you don't understand it.
                                              Removing 'y' from strFormat1 NOT removed it from strFormat2.
                                             Try to Debug this piece of code if you not trust CString constructor.
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 25 June 2009 at 12:57am
>> a small comment to prev post:
CString strFormat2(strFormat1); //this is 2 distinct CStrings now - Surprise you don't understand it.
                                              Removing 'y' from strFormat1 NOT removed it from strFormat2.
                                             Try to Debug this piece of code if you not trust CString constructor. <<

With all due respect mdoubson, that was my point. They are 2 distinct strings yet the code is "acting" as if they are one. I watched it in the debugger and when strFormat1 was stripped, it also stripped strFormat2. The CString constructor worked fine. I haven't had a chance to play with it further since I do have other tasks but it acts like a memory overwrite. The proof was in the display and in the debugger. Has anyone at CJ tried or been able to duplicate the bug? Maybe it's a peculiarity of a certain build environment or properties.
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 June 2009 at 7:36pm
see snapshot with Watches
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2009 at 3:04pm

This effect can also be seen in the demo so its nothing unique with my code.

Compiled with VS 2005. Static Unicode.

After:

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: 04 July 2009 at 3:17pm
Your watches show differences - one don't have comma !?
 
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 04 July 2009 at 3:20pm
Correct. When the yyyy is stripped from strFormat1 it also strips it from strFormat2 and leaves the comma in strFormat2. The display in the caption bar shows this as well. It shows something like: July 3 - July 10, 

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: 04 July 2009 at 3:31pm
See picture - it show 28 June - 4 July 2009 y. (VS2008)
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 05 July 2009 at 4:28pm
If the error is never produced while scrolling, then it must be either the compiler or the build. I see nothing obvious in the code that is producing the error or I would have fixed it a long time ago. When the strip method returns strFormat1, strFormat2 is also changed.

VS 2005 using static, unicode definitely fails.

Perhaps someone can configure a 2005 build and see what they get. As you can see, it can be reproduced using week or month modes.







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: 05 July 2009 at 11:08pm
Check you setting for code optimization
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: 08 July 2009 at 12:44pm

This is current (after official 13.1 release) MFC Calendar source updates: https://forum.codejock.com/uploads/DemoVersion/CalendarControlMFCUpdated.rar

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

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 10 August 2009 at 3:27pm
The results seem to be improved but problem still occurs when transitioning between 2 different months such as Apr-May etc.

Tested with

Visual Studio 2005
Visual Studio 2008

Static Unicode debug
Static Unicode release

CJ Version 13.1 with the update from this thread (after official 13.1 release) .

Used "Deployment Wizard" to compile libraries so any optimizations are provided by CJ.
Build command lines are unmodified from CJ.

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: 10 August 2009 at 3:43pm
I don't understand the term improved here - is it working or not?
 
Could you run static app https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar and see some problems?
 
Of cource - this is non-uncode release mode. If you want - I can build static unicode release also.
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2009 at 4:23pm
The example you provided fails in exactly the same manner.

1. Week view display (column or standard).  Display is: "February 23 - March 01,"
Note the comma trailing 05.

2. Month view display. Display is: "February - March,"
Again note the trailing comma.

This is consistent with the debugger output and program display in my testing.

It would seem that Unicode is not the determining factor.
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: 11 August 2009 at 6:11pm
The snaphot you use - 13.0. This is 13.1 run from my link (check-box for MultiColumn mode - on your snapshot - radio-button).
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2009 at 6:43pm
Week/Month modes illustrating problem. Version 13.1. This is the build you posted.



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: 11 August 2009 at 6:50pm
Right - so the problem is in some local settings - for XP-RU everything is proper. I will switch to XP-EN and give you know
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: 11 August 2009 at 8:38pm
Thanks for you pressing. Confirmed on XP-EN.
Get updated source, static app and activex
 
https://forum.codejock.com/uploads/DemoVersion/CalendarControlMFCUpdated.rar
 
 
The problem was not in code you pointed but on more deep level in old code of CXTPCalendarUtils::StripFormat function
Back to Top
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Posted: 13 August 2009 at 12:41pm
It now works properly in my builds.

Thank you for the fix. 
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.