Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Undocumented calendar dependencies
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Undocumented calendar dependencies

 Post Reply Post Reply
Author
Message
BobC View Drop Down
Groupie
Groupie


Joined: 28 April 2017
Location: Longmont, CO
Status: Offline
Points: 55
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobC Quote  Post ReplyReply Direct Link To This Post Topic: Undocumented calendar dependencies
    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

Back to Top
BobC View Drop Down
Groupie
Groupie


Joined: 28 April 2017
Location: Longmont, CO
Status: Offline
Points: 55
Post Options Post Options   Thanks (0) Thanks(0)   Quote BobC Quote  Post ReplyReply Direct Link To This Post 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);

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.141 seconds.