Print Page | Close Window

Problems getting calendar to exit properl

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=2991
Printed Date: 04 December 2024 at 3:29am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problems getting calendar to exit properl
Posted By: RolandoE.
Subject: Problems getting calendar to exit properl
Date Posted: 03 October 2005 at 8:37am

Hi,

I've tried everything I can think about. I even copied code from another proyect which uses the Calendar Control successfully and I am still having some problems with the following code.   The program comes up and everything runs fine. There is no code to post events or anything like this. All I am doing right now is displaying the Calendar control and linking it with the Date Picker control via the CXTPCalendartController class.

Within CDlgAgenda::OnInitDialog()...

// Create Calendar Control Window
if (!m_wndCalendar.Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BOR DER, CRect(0,0,0,0), this, 333))
return -1;

// Attach Date Picker and Calendar Control to Calendar Controller
// Causing error at program close!!
m_CalendarController.SetCalendar(&m_wndCalendar);
m_CalendarController.SetDatePicker(&m_wndDatePicker);
m_wndCalendar.SwitchActiveView(xtpCalendarMonthView);

The problem I am having is when the application exits I am getting an error within CCmdTarget::~CCmdTarget()!! Tracing back I get to CWnd::~CWnd(), CXTPCalendarControl::~CCalendarControl() then finally CDlgAgenda::~CDlgAgenda() (This is where the calendar control is found).

The weird part is that I do not have this problem if I comment out the following line:

m_CalendarController.SetCalendar(&m_wndCalendar);

Any ideas? Do you need more information? I already tried creating the calendar control within OnCreate().

Thanks for the help.

Rolando



-------------
Rolando E. Cruz-Marshall



Replies:
Posted By: RolandoE.
Date Posted: 03 October 2005 at 5:30pm

More on previous message!!!

I do not know if this matters at this point but I only get the above mentioned behaviour in DEBUG mode only!



-------------
Rolando E. Cruz-Marshall


Posted By: sserge
Date Posted: 04 October 2005 at 1:33am
Rolando,

It looks like an assertion could be caused because a destructor for the Calendar is called before the destructor for Controller.

Try to Set calendar and date picker to NULL in your dialog destructor:

CDlgAgenda::~CDlgAgenda
{
    m_CalendarController.SetCalendar(NUL L);
    m_CalendarController.SetDatePicker(N ULL);
}


--
WBR,
Serge


Posted By: RolandoE.
Date Posted: 04 October 2005 at 7:26am
Thanks It worked!!

-------------
Rolando E. Cruz-Marshall



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