Event click and drag HitTest.ViewEvent |
Post Reply |
Author | |
WaaZ
Senior Member Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
Post Options
Thanks(0)
Posted: 13 March 2006 at 9:42am |
At times, when you drag an occurence, HitTest.ViewEvent returns null. If I listen to mouse down before that and get the reference to the occurence, I do not get the new values of the start and end time of the occurence (an exception). This does not always happen. It happens generally when you try to click and move the occurence very quickly. Thanks WaaZ |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
The problem can be in the CalendarControl because you call Application.doevents from OnMouseMove when dragging is still processing but OnMouseMove method (as well as LButtolDown, LButtolUp) is not reenterable. Just do not use DoEvents inside user interface processing chain. Also I'd suggest you to look once more to the topic https://forum.codejock.com/forum_posts.asp?TID=3688&TPN= 1 -- WBR, Serge |
|
WaaZ
Senior Member Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
Post Options
Thanks(0)
|
I have removed all the Application.doevents since quite a long time, and I do not have a onMouseMove listener. The problem is raised when you perform the click n drag really quickly. |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Quickly... In this case HitTest.ViewEvent is null because a mouse pointer is not located over the event area.
Try to use BeforeEditOperation event to store last dragged event state. This should be more independend on user speed The idea is following: --------------------------------------------------- BeforeEditOperation(CalendarEditOperationParameters* OpParams, BOOL* bCancelOperation) { if (OpParams.Operation = xtpCalendarEO_DragMove || OpParams.Operation = xtpCalendarEO_DragCopy ) // ... xtpCalendarEO_DragXXX, { if (OpParams.DraggingEventNew != Null) { g_pLastDraggedEvent = OpParams.DraggingEventNew.CloneEvent(); } } } -- WBR, Serge |
|
WaaZ
Senior Member Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
Post Options
Thanks(0)
|
Normally, it works fine with the non-recurring events. The mouse-down gives me a reference to the object, but still, it holds the old date values. Similar to the reference obtained in the before_Edit.. If I use CloneEvent(), I will get a copy and I will not get the new date values for the change. Thnks WaaZ |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
Couple notes on how it works: BeforeEditOperation is called for each dragging step - before each changing of pDraggingEventNew. CalendarEditOperationParameters has 2 members: -- DraggingEvent - contains an event copy for previous dragging step; actual value of pDraggingEventNew; -- DraggingEventNew - contains a new event copy which will be set to pDraggingEventNew for this dragging step. Also you can cancel applying to restrict some kind of dragging (for example drag to some days or by other condition). For this case we have to remember the latest (not the first) copy of CalendarEditOperationParameters.DraggingEventNew which contains event for the end of dragging operation. Anyway, it looks a little bit strange, could you please describe in more details when do you call HitTest and how do you expect to receive a new event after dragging? -- WBR, Serge |
|
WaaZ
Senior Member Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
Post Options
Thanks(0)
|
Hi, Another solution is to use ActiveView.getSelectedEvent(), since when you finish dragging the item, your event will eventually be selected. Thus, u have a reference to your event. Thnks WaaZ |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |