Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Regarding Week Mode. DoRetriveDayEvents Problem?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Regarding Week Mode. DoRetriveDayEvents Problem?

 Post Reply Post Reply
Author
Message
KumarCJ View Drop Down
Groupie
Groupie
Avatar

Joined: 02 April 2007
Location: India
Status: Offline
Points: 96
Post Options Post Options   Thanks (0) Thanks(0)   Quote KumarCJ Quote  Post ReplyReply Direct Link To This Post Topic: Regarding Week Mode. DoRetriveDayEvents Problem?
    Posted: 28 April 2008 at 8:32am

Hello,

We are using custom data provider for calendar control.

Flow is below:

From View class

void fun1()
{
 CXTPCalendarView* pView = GetCalendarCtrl().GetActiveView();
 if (pView && pView->GetViewType() != xtpCalendarWeekView)
 {
       GetCalendarCtrl().SwitchActiveView(xtpCalendarWeekView);
 }
}

SwitchActiveView calls DoRetrieveDayEvents

CXTPCalendarEventsPtr CCalendarDataProviderSQL::DoRetrieveDayEvents(COleDateTime dtDay)
{
 ----------------------------------

 /*CXTPCalendarEventsPtr ptrEvents; Define in .h file as member variable of class*/

 ptrEvents = new CXTPCalendarEvents();
 pView->GetEventsFromWeekData(ptrEvents);
 return ptrEvents;
}

we are calling views function from "DoRetrieveDayEvents()" who retrive the data from our database and add data as events
Please note that we are taking CXTPCalendarEventsPtr input parameter as a reference.

void MyView::GetEventsFromWeekData(CXTPCalendarEventsPtr& ptrEvents)
{
 //Retrive data for week

 for(i=0;i<7;i++)
 {
  Code to fetch data...
 
 //Add data  as event.
 m_pCalendar = &GetCalendarCtrl();
    pCalendarData = m_pCalendar->GetDataProvider();

        ptrEvent = pCalendarData->CreateNewEvent();
  
        ptrEvent->SetStartTime(evntStTime);
 ptrEvent->SetEndTime(evntEndTime);
 ptrEvent->SetSubject(strSubject);
  
    if (ptrEvent)
 {
  ptrEvents->Add(ptrEvent);
 }
 }//For loop ends here
}

ISSUE:
Application getting crash in
file name:  XTPCalendarViewDay.h
function name: virtual void Populate(COleDateTime dtDayDate)
Crash at: if (dtDayDate < CXTPCalendarUtils::ResetTime(pEvent->GetStartTime()) ||
  dtDayDate > CXTPCalendarUtils::ResetTime(pEvent->GetEndTime()) )
  {
   ASSERT(FALSE);
   TRACE(_T("ERROR data: Day: %s  EVENT {%s - %s} \n"),
     (LPCTSTR)dtDayDate.Format(_T("#%Y-%m-%d#")),
        (LPCTSTR)CXTPCalendarUtils::ResetTime(pEvent->GetStartTime()).Format(_T("#%Y-%m-%d#")),
        (LPCTSTR)CXTPCalendarUtils::ResetTime(pEvent->GetEndTime()).Format(_T("#%Y-%m-%d#"))
   ); 
  }

I had added 3 days data, but after ignoring the crash, it show me first day of week data only.

Please help me out in this.

Thanks,
Kumar

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