Print Page | Close Window

BUG (?): DragCopy event ID

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=7435
Printed Date: 09 May 2024 at 6:34pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: BUG (?): DragCopy event ID
Posted By: gniemcew
Subject: BUG (?): DragCopy event ID
Date 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




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



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