Print Page | Close Window

Week view mode title

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=14558
Printed Date: 21 November 2024 at 3:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Week view mode title
Posted By: zaksoft
Subject: Week view mode title
Date 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




Replies:
Posted By: Algae
Date 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!??




Posted By: mdoubson
Date 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.


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


Posted By: Algae
Date 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.


Posted By: mdoubson
Date Posted: 25 June 2009 at 7:36pm
see snapshot with Watches

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


Posted By: Algae
Date 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:



Posted By: mdoubson
Date Posted: 04 July 2009 at 3:17pm
Your watches show differences - one don't have comma !?
 


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


Posted By: Algae
Date 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, 



Posted By: mdoubson
Date Posted: 04 July 2009 at 3:31pm
See picture - it show 28 June - 4 July 2009 y. (VS2008)

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


Posted By: Algae
Date 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.









Posted By: mdoubson
Date Posted: 05 July 2009 at 11:08pm
Check you setting for code optimization

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


Posted By: mdoubson
Date 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 - https://forum.codejock.com/uploads/DemoVersion/CalendarControlMFCUpdated.rar



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


Posted By: Algae
Date 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.



Posted By: mdoubson
Date 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 - 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.


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


Posted By: Algae
Date 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.


Posted By: mdoubson
Date 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).


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


Posted By: Algae
Date Posted: 11 August 2009 at 6:43pm
Week/Month modes illustrating problem. Version 13.1. This is the build you posted.





Posted By: mdoubson
Date 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

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


Posted By: mdoubson
Date 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/CalendarDemoStatic.rar - https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar
https://forum.codejock.com/uploads/DemoVersion/CalendarControlMFCUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/CalendarControlMFCUpdated.rar
 
https://forum.codejock.com/uploads/DemoVersion/CalendarControlUpdated.rar - https://forum.codejock.com/uploads/DemoVersion/CalendarControlUpdated.rar
 
The problem was not in code you pointed but on more deep level in old code of CXTPCalendarUtils::StripFormat function


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


Posted By: Algae
Date Posted: 13 August 2009 at 12:41pm
It now works properly in my builds.

Thank you for the fix. 



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