Print Page | Close Window

Undocumented calendar dependencies

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=23637
Printed Date: 23 November 2024 at 2:56am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Undocumented calendar dependencies
Posted By: BobC
Subject: Undocumented calendar dependencies
Date Posted: 07 May 2018 at 6:59pm
This post is venting at Codejock documentation as much as it is a request for anyone with experience to tell me where I have gone wrong.

I'm using Xtreme Toolkit 18.3.0 with Visual Studio 15.7.0 on Windows 10, version 1709, build 16299.309.

I have a CXTPCalendarControl, a CXTPCalendarCaptionBarControl, and a CXTPCalendarCaptionBarTheme in a form view. They are declared in the form's header file as:
CXTPCalendarCaptionBarTheme m_oCaptionBarTheme;
CXTPCalendarCaptionBarControl m_calCaptionBar;
CXTPCalendarControl m_calMain;

In the form's OnInitialUpdate(), these calls are made:
m_oCaptionBarTheme.SetPaintTheme(xtpCalendarThemeVisualStudio2015);

m_calCaptionBar.SetTheme(&m_oCaptionBarTheme);
m_calCaptionBar.EnableTimeline(FALSE);
m_calCaptionBar.EnableMulticolumns(FALSE);

m_calMain.ModifyStyle(0, WS_BORDER, SWP_FRAMECHANGED);
m_oCaptionBarTheme.AttachCalendar(&m_calMain);
m_nDayScaleMinutes = m_calMain.GetCalendarOptions()->nDayView_ScaleInterval;
OnCalendarViewWorkWeek();

CXTPCalendarDayView* pDayView = DYNAMIC_DOWNCAST(CXTPCalendarDayView, m_calMain.GetDayView());
if(pDayView)
{
pDayView->ScrollToWorkDayBegin();
}

SetTheme(xtpCalendarThemeVisualStudio2015);

The contents of SetTheme() are the same as those in Codejock's calendar demo, minus the CCalendarDemoView's view-specific calls that do not apply to this form view, such as _ResizeControls() and the scrollbar handling.

1. It appears that there are no default settings in a caption bar for a theme if the user doesn't set one. If AttachCalendar() is called without first calling CXTPCaptionBar::SetTheme(), AttachCalendar() will fail because its m_pCaptionBar pointer is null.

A default theme would be good.

2. There is some sort of declaration dependency because different types of application shutdown crashes can occur within one of those classes, depending on declaration order. 

For example, if declared in the order shown above, and the caption bar theme is set as in the code above, then on app shutdown, a heap corruption exception is thrown in the CXTPCalendarCaptionBarControl's destructor on its only line of code:
CMDTARGET_RELEASE(m_pTheme);

I have not yet determined what the true cause of the heap corruption is.

Bob




Replies:
Posted By: BobC
Date Posted: 08 May 2018 at 1:14pm
It looks like specifically creating and using the caption bar theme is a big part of the problem. This code works, where GetTheme() is used in the AttachCalendar() call instead of using the declared caption bar theme itself:
// m_oCaptionBarTheme.SetPaintTheme(xtpCalendarThemeVisualStudio2015);
// m_calCaptionBar.SetTheme(&m_oCaptionBarTheme);
// m_oCaptionBarTheme.AttachCalendar(&m_calMain);
m_calCaptionBar.GetTheme()->AttachCalendar(&m_calMain);




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