Print Page | Close Window

Event click and drag HitTest.ViewEvent

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=3766
Printed Date: 03 December 2024 at 1:43pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Event click and drag HitTest.ViewEvent
Posted By: WaaZ
Subject: Event click and drag HitTest.ViewEvent
Date 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




Replies:
Posted By: sserge
Date Posted: 13 March 2006 at 2:26pm
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 - https://forum.codejock.com/forum_posts.asp?TID=3688&TPN= 1

--
WBR,
Serge


Posted By: WaaZ
Date Posted: 15 March 2006 at 7:00am

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.



Posted By: sserge
Date Posted: 16 March 2006 at 1:59pm
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


Posted By: WaaZ
Date Posted: 19 March 2006 at 10:27am

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



Posted By: sserge
Date Posted: 20 March 2006 at 6:45am
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


Posted By: WaaZ
Date Posted: 20 March 2006 at 7:08am

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




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