Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - event and recurrence dialogs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

event and recurrence dialogs

 Post Reply Post Reply
Author
Message
Algae View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 January 2007
Location: United States
Status: Offline
Points: 217
Post Options Post Options   Thanks (0) Thanks(0)   Quote Algae Quote  Post ReplyReply Direct Link To This Post Topic: event and recurrence dialogs
    Posted: 20 March 2007 at 7:44pm
I've been using some of the code from the calendar event dialogs to build propertysheet pages, and ran across what appears to be a bug where values are prepared for the recurrence dialog:

"CXTPCalendarEventPropertiesDlg::OnBnClickedButtonRecurrecnce()

if (nRState != xtpCalendarRecurrenceMaster)
{
    ....
    if (nRState == xtpCalendarRecurrenceNotRecurring)
    ...
        COleDateTimeSpan spDuration = m_dtEndDate - m_dtStartDate;
    ...
}

Unless this has some other purpose that I haven't discovered yet, it would seem to me the correct code should be:

COleDateTimeSpan spDuration = m_dtEndTime - m_dtStartTime;

This makes the values in the recurrence dialog start and end time boxes coincide with those in the event dialog. (duration too). Or am I missing the intent of the code?

Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 24 March 2007 at 5:43pm
By implementation m_dtStartDate, m_dtEndDate contain time part also.
But not actual time from controls - it is initial time.
 
The fix is the folowing (changed lines are bold). Thanks for your notes.

CXTPCalendarEventPropertiesDlg::OnBnClickedButtonRecurrecnce()
{
        .........................
 

  if (nRState == xtpCalendarRecurrenceNotRecurring)
  {
   VERIFY(ptrMasterEvent->MakeEventAsRecurrence());
   bWasNotRecur = TRUE;
 
   CXTPCalendarRecurrencePatternPtr ptrPattern;
   ptrPattern = ptrMasterEvent->GetRecurrencePattern();
 
   COleDateTime dtStartDateTime(CXTPCalendarUtils::UpdateTime(m_dtStartDate, m_dtStartTime));
   COleDateTime dtEndDateTime(CXTPCalendarUtils::UpdateTime(m_dtEndDate, m_dtEndTime));
 
   COleDateTimeSpan spDuration = dtEndDateTime- dtStartDateTime;
 
   ptrPattern->SetStartTime(CXTPCalendarUtils::ResetDate(m_dtStartTime));
   ptrPattern->SetDurationMinutes((int) spDuration.GetTotalMinutes());
 
   ptrPattern->SetPatternStartDate(CXTPCalendarUtils::ResetTime(m_dtStartDate));
 
   ptrMasterEvent->UpdateRecurrence(ptrPattern);
  }


--
WBR,
Serge
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.125 seconds.