Week view mode title |
Post Reply |
Author | |
zaksoft
Senior Member Joined: 05 June 2003 Location: Italy Status: Offline Points: 162 |
Post Options
Thanks(0)
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 |
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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!?? |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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.
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
>> 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. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
see snapshot with Watches
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
This effect can also be seen in the demo so its nothing unique with my code. Compiled with VS 2005. Static Unicode. After: |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Your watches show differences - one don't have comma !?
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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,
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
See picture - it show 28 June - 4 July 2009 y. (VS2008)
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Check you setting for code optimization
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
This is current (after official 13.1 release) MFC Calendar source updates: https://forum.codejock.com/uploads/DemoVersion/CalendarControlMFCUpdated.rar |
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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.
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
The snaphot you use - 13.0. This is 13.1 run from my link (check-box for MultiColumn mode - on your snapshot - radio-button).
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
Week/Month modes illustrating problem. Version 13.1. This is the build you posted.
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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 |
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
It now works properly in my builds.
Thank you for the fix. |
|
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 |