Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - How to disable multiday event.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to disable multiday event.

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

Joined: 27 February 2007
Location: India
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote Makarand Quote  Post ReplyReply Direct Link To This Post Topic: How to disable multiday event.
    Posted: 19 November 2008 at 5:08am
Hi,

I do not want to allow user to have a multiday event (since my application doesnt support this feature)

Can you tell me what is the way to disable adding a multiday event in calendar ?
Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post Posted: 20 November 2008 at 12:44am
Hi Mak,

Try adding following where you are creating an event

ptrEvent->SetAllDayEvent(FALSE);

I hope this will help you ;)
Back to Top
Makarand View Drop Down
Senior Member
Senior Member
Avatar

Joined: 27 February 2007
Location: India
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote Makarand Quote  Post ReplyReply Direct Link To This Post Posted: 20 November 2008 at 1:20am
Thanks Prashant,

SetAllDayEvent(..) member function is used to set the "All Day" flag for an event. which is only for single day.
I do not want to allow user to have a multiday event.
see the attached image for more detail.



-Mak
Back to Top
Makarand View Drop Down
Senior Member
Senior Member
Avatar

Joined: 27 February 2007
Location: India
Status: Offline
Points: 140
Post Options Post Options   Thanks (0) Thanks(0)   Quote Makarand Quote  Post ReplyReply Direct Link To This Post Posted: 20 November 2008 at 4:54am
Got it!!!!!!!!!!!!!1

following code to handle the case


void CCalendar::OnEvent_BeforeEditAction(XTP_NOTIFY_CODE Event,
                                                                 WPARAM wParam, LPARAM lParam)
{        
     if (XTP_NC_CALENDAR_BEFORE_EVENT_EDIT_OPERATION != Event) {
          ASSERT(FALSE);
          return;
     }
         
     XTP_EVENT_EDIT_OPERATION_PARAMS* pOPparams = (XTP_EVENT_EDIT_OPERATION_PARAMS*)wParam;
     BOOL* pbHandled = (BOOL*)lParam;
     ASSERT(pbHandled && pOPparams);

     CXTPCalendarEvent* pEventNew = GetCalendarCtrl().GetActiveView()->GetDraggingEventNew();
     if(pEventNew)
     {
          COleDateTime dtNew,dtOrig;
          dtNew = pEventNew->GetStartTime();
          //check start time
          dtOrig = GetCalendarCtrl().GetActiveView()->GetDraggingEventOrig()->GetStartTime();
          dtNew = pEventNew->GetStartTime();
          if(dtNew.GetDay() != dtOrig.GetDay())
               *pbHandled = TRUE;
          //check end time
          dtOrig = GetCalendarCtrl().GetActiveView()->GetDraggingEventOrig()->GetEndTime();
          dtNew = pEventNew->GetEndTime();
          if(dtNew.GetDay() != dtOrig.GetDay())
               *pbHandled = TRUE;
     }     
}


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.