Print Page | Close Window

Drag/Drop

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=3457
Printed Date: 21 November 2024 at 9:16pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Drag/Drop
Posted By: dhnaigles
Subject: Drag/Drop
Date Posted: 31 December 2005 at 5:14pm

Is it possible to enable drag/drop. I have a label that I want to drag onto the calendar and create an event based upon the caption of the label and the date & time where it is dropped?  any ideas?




Replies:
Posted By: sserge
Date Posted: 02 January 2006 at 9:44am
Hi,

It's not yet available as a standard feature, but you can try to implement it with some of standards methods of your language, or catch mouse button down/up (/move) events as a workaround.

To determine the mouse position over the calendar you can use HitTest() method.

--
WBR,
Serge


Posted By: dhnaigles
Date Posted: 03 January 2006 at 2:57pm

Serge- 

How would I use the HitTest() method to retrieve the begin and/or end datetime?  Can you give me an example of VB code that would return those values so that I can add an event?  Thanks.

 

David



Posted By: sserge
Date Posted: 04 January 2006 at 6:07am
David,

Sorry, I've just realized these members are not included in the ActiveX interface. So, for the next version 2 new properties will be added to CalendarHitTestInfo:
 
DATE HitDateTime;      ' Date or Date and Time corresponding to the cursor position.  

Boolean TimePartValid; ' true for the DayViewCell and DayViewTimeScale areas,
                               ' false for Week and Month views and for DayViewAllDayEvent area.
 
--
WBR,
Serge


Posted By: eSynaptic
Date Posted: 07 March 2006 at 10:48pm
I created a work around it by dragging the label into the calendar then simulating a mouse click upon drop. Here is my code:

'declarations
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_LEFTDOWN = &H2
Const MOUSEEVENTF_LEFTUP = &H4
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10

'simulate a double click to fire the calendar's dblclick event
Private Sub CalendarControl_DragDrop(Source As Control, x As Single, y As Single)

mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, x, y, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, x, y, 0, 0       

End Sub

'get the selected times
Private Sub CalendarControl_DblClick()
Dim BeginTime As Date
Dim EndTime As Date
Dim bAllDay As Boolean

CalendarControl.DayView.GetSelection BeginTime, EndTime, bAllDay

Debug.Print BeginTime
Debug.Print EndTime

End Sub



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