Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Event click and drag HitTest.ViewEvent
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Event click and drag HitTest.ViewEvent

 Post Reply Post Reply
Author
Message
WaaZ View Drop Down
Senior Member
Senior Member


Joined: 31 January 2006
Location: United Kingdom
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaaZ Quote  Post ReplyReply Direct Link To This Post Topic: Event click and drag HitTest.ViewEvent
    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

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: 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

--
WBR,
Serge
Back to Top
WaaZ View Drop Down
Senior Member
Senior Member


Joined: 31 January 2006
Location: United Kingdom
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaaZ Quote  Post ReplyReply Direct Link To This Post 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.

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: 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
Back to Top
WaaZ View Drop Down
Senior Member
Senior Member


Joined: 31 January 2006
Location: United Kingdom
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaaZ Quote  Post ReplyReply Direct Link To This Post 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

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: 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
Back to Top
WaaZ View Drop Down
Senior Member
Senior Member


Joined: 31 January 2006
Location: United Kingdom
Status: Offline
Points: 103
Post Options Post Options   Thanks (0) Thanks(0)   Quote WaaZ Quote  Post ReplyReply Direct Link To This Post 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

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