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

Loading calendar data

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


Joined: 01 December 2009
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote EricFowler Quote  Post ReplyReply Direct Link To This Post Topic: Loading calendar data
    Posted: 24 December 2009 at 12:39am
I am able to save calendar data to a file using the default, RAM provider. I do this by getting the data source, and setting it's connection string to a file name.

I then execute this code:

void CCalendar::OnDestroy()
{
     
     CXTPCalendarData * pData = this->GetDataProvider();
     if(pData)
     {
          if(pData->IsOpen())
          {
               pData->Save();
               pData->Close();
          }
     }
     
     __super::OnDestroy();

     Revoke();
}


It creates a binary file, and I can see my data in it. All is good.

Now I need to load the data from the file into the app. I looked for a CXTPCalendarData::Load() or -Read() function to no avail.

I tried using Populate(), to no avail. Nothing loads.

What do I need to do? It should be simple.

Eric
Back to Top
EricFowler View Drop Down
Groupie
Groupie


Joined: 01 December 2009
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote EricFowler Quote  Post ReplyReply Direct Link To This Post Posted: 25 December 2009 at 11:06pm
*bump*

I know it's Christmas (for a little longer anyway) but I am stuck on this, so if any of Santa's elves know how to fix it, I have a candy cane for you.

Eric
Back to Top
EricFowler View Drop Down
Groupie
Groupie


Joined: 01 December 2009
Status: Offline
Points: 14
Post Options Post Options   Thanks (0) Thanks(0)   Quote EricFowler Quote  Post ReplyReply Direct Link To This Post Posted: 26 December 2009 at 3:51pm
Looking at this further, I am calling Populate() but it is returning no data ... calendar remains empty.

Here is the code:
     m_ctrlCalendar.SetDataProvider(xtpCalendarDataProviderMemory);

     CXTPCalendarData * pData = m_ctrlCalendar.GetDataProvider();
     CString strConnect = _T("Provider=XML;Data Source='.\\mystuff.caldata.xml'");
     
     pData->SetConnectionString(strConnect);

     VERIFY(m_ctrlCalendar.Create(WS_CHILD | WS_VISIBLE , rcCalendar, this, IDC_CALENDAR_CTRL_ID));
     m_ctrlCalendar.ModifyStyleEx(0, WS_EX_STATICEDGE, 0);


     CXTPCalendarControl::CUpdateContext updateCNT(&m_ctrlCalendar);

     m_ctrlCalendar.Populate();
     m_ctrlCalendar.RedrawControl();

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