Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - BUG (?): DragCopy event ID
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

BUG (?): DragCopy event ID

 Post Reply Post Reply
Author
Message
gniemcew View Drop Down
Newbie
Newbie


Joined: 22 June 2007
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote gniemcew Quote  Post ReplyReply Direct Link To This Post Topic: BUG (?): DragCopy event ID
    Posted: 23 June 2007 at 8:37am
Hi,

Here is an interesting one: when handling drag and drop copy (Ctrl + drag) XTP_NC_CALENDAR_BEFORE_EVENT_EDIT_OPERATION::xtpCalendarEO_DragCopy notification, XTP_EVENT_DRAG_OPERATION_PARAMS member pDraggingEventNew contains the same event ID as the original pDraggingEvent. Effectively, there is no way to know what ID the newly created event will contain once the drag operation has been completed.

Anyone else run into this? Any ideas how to solve this one?

Thanks...

Gary

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: 07 July 2007 at 3:26pm
Hi,

The Calendar control uses AddEvent method of data provider.
You can catch calendar notification XTP_NC_CALENDAREVENTWASADDED.
 
Also to mark that event is coming from dragCopy operation, you can use event custom properties.
 
I mean inside XTP_NC_CALENDAR_BEFORE_EVENT_EDIT_OPERATION notification handler set a custom property for new event, like:

    COleVariant varOrigID = (long)pDraggingEventNew->GetEventID();
    pDraggingEventNew->GetCustomProperties()->SetProperty("DragCopyEventIDorig",  varOrigID);
 
Inside XTP_NC_CALENDAREVENTWASADDED notification handler:
 
    CXTPCalendarEvent* pEvent = (CXTPCalendarEvent*)lParam;
    COleVariant varOrigID;

    if (pEvent->->GetCustomProperties()->GetProperty("DragCopyEventIDorig",  varOrigID))
    {
        // this event added by DragCopy operation.
        DWORD dwNewID = pEvent->GetEventID();
                   
        // as example, remove this custom property and update event 
        pEvent->GetCustomProperties()->RemoveProperty("DragCopyEventIDorig");
        VERIFY( pEvent->GetDataProvider()->ChangeEvent(pEvent) );
    }    


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