Print Page | Close Window

event and recurrence dialogs

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=6687
Printed Date: 05 May 2024 at 5:07pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: event and recurrence dialogs
Posted By: Algae
Subject: event and recurrence dialogs
Date 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?




Replies:
Posted By: sserge
Date 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



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