Release the DrogDrop Event |
Post Reply |
Author | |
McKloony
Senior Member Joined: 09 January 2007 Location: Germany Status: Offline Points: 340 |
Post Options
Thanks(0)
Posted: 18 November 2007 at 8:01am |
I want to drag some entrys from a ReportControl to the CalenadarControl. Does anybody know, how to release the DragDrop Event of the CalenderControl? It is not necessary to drop the real data, the only thing i want to do is, to release teh DragDrop event and to enable the CalenderControl to be able, to receive the DragOver command.
|
|
Product: Xtreme SuitePro (ActiveX) 16.2.5
Platform: XP / Windows 7 Language: Visual Basic 6.0 SP6 |
|
Rafael
Newbie Joined: 26 November 2007 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
Are you trying to drag an object/control onto the calendarControl? If so, the DragDrop of the calendarControl handles this. If dragging an event/appointment onto another cell, override the eventchangedex function or the doupdateevent function.
|
|
Rafael
Newbie Joined: 26 November 2007 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
If you click and hold on the reportconrtol then drag over the CalendarControl, the DragOver event will fire, when you let go, the DragDrop will fire. You can catch were you let go using the HitTest.HitCode. Use the xtpCalendarHitTest Enum to compare the hitcode. Then you can create an event using calendarcontrol.dataprovider.createevent and set all the members and properties. Note:DragDrop can only possibly happen after dragover, and both events only happen when dragging another control over the calendarControl control. You cannot drag the calendar control over itself I think.
|
|
McKloony
Senior Member Joined: 09 January 2007 Location: Germany Status: Offline Points: 340 |
Post Options
Thanks(0)
|
Thank you Rafael. The problem i have is, that when i try to drag a ReportEntry from the ReportControl into the CalendarControl, the Cursor shows, that it is not possible. I Set:
XtremeReportControl.ReportControl.EnableDragDrop("Test", xtpReportAllowDragCopy)
How can i adjust the CalenderControl to be able onto DropMode?
|
|
Product: Xtreme SuitePro (ActiveX) 16.2.5
Platform: XP / Windows 7 Language: Visual Basic 6.0 SP6 |
|
Rafael
Newbie Joined: 26 November 2007 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
You are correct with the EnableDragDrop. I put a CalendarControl on the report control sample that had an example of drag and drop from a list onto a report control. I'm missing somthing, because I could not get the CalendarControl_DragOver event to fire when dragging from the report control onto the CalendarControl. Put in my own application, I am using a 3rdparty grid and I am able to drag a cell from it onto my CalendarControl no problems. I do not have any properties set to allow this on the Calendar control, so I'm not sure what we are missing right now. I'll test more later.
|
|
edderic
Newbie Joined: 19 December 2007 Location: Belgium Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Have you a sample (code) how to drag and drop from a grid to the calendarcontrol ?
Thanks
|
|
Rafael
Newbie Joined: 26 November 2007 Location: United States Status: Offline Points: 28 |
Post Options
Thanks(0)
|
You may first need to begin the drag event from what ever control you are dragging from. Like on most grids, on a DragCell event, you can do a Control.Drag vbBeginDrag. Then, on the calendar control, you capture a drag on the DragDrop event like the following.
<code>
Private Sub CalendarControl_DragDrop(Source As Control, x As Single, Y As Single)
Dim m_pEditingEvent As CalendarEvent Dim HitTest As CalendarHitTestInfo 'Test Location of Drop Set HitTest = CalendarControl.ActiveView.HitTest 'Check drop zone is valid
If CalendarControl.ViewType = xtpCalendarDayView Or CalendarControl.ViewType = xtpCalendarWorkWeekView Then '8193 OR 16385 If HitTest.HitCode = (xtpCalendarHitTestGroupArea + xtpCalendarHitTestDayViewCell) Or HitTest.HitCode = (xtpCalendarHitTestGroupArea + xtpCalendarHitTestDayViewAllDayEvent) Then 'ok Else Exit Sub End If ElseIf CalendarControl.ViewType = xtpCalendarMonthView Or CalendarControl.ViewType = xtpCalendarWeekView Then '1 OR 2 If HitTest.HitCode = xtpCalendarHitTestGroupArea Or HitTest.HitCode = xtpCalendarHitTestDayHeader Then 'ok Else Exit Sub End If Else Exit Sub End If 'Create new Event
Set m_pEditingEvent = CalendarControl.DataProvider.CreateEvent 'Get date selection Dim BeginSelection As Date, EndSelection As Date, AllDay As Boolean, EndTime As Date CalendarControl.ActiveView.GetSelection BeginSelection, EndSelection, AllDay 'Create Calendar Event m_pEditingEvent.StartTime = BeginSelection m_pEditingEvent.EndTime = EndSelection m_pEditingEvent.Subject = "My Subject" m_pEditingEvent.Location = "My Location" m_pEditingEvent.AllDayEvent = AllDay m_pEditingEvent.Body = "My Body" m_pEditingEvent.Label = 0 m_pEditingEvent.BusyStatus = xtpCalendarBusyStatusFree m_pEditingEvent.PrivateFlag = 0 m_pEditingEvent.MeetingFlag = 0 'Add Event to Calendar CalendarControl.DataProvider.AddEvent m_pEditingEvent Screen.MousePointer = vbDefault
End Sub
</code>
You should test the hitcode to know exactly where you are droping and react how you want based on the location. This drop will create an event on the location where you droped. Now, just change the fields to data found the the selected row of your grid or selected text in a control.
|
|
edderic
Newbie Joined: 19 December 2007 Location: Belgium Status: Offline Points: 7 |
Post Options
Thanks(0)
|
it is not working with sharpgrid Oledrag !
have you some code from a grid ? (vbbegindrag etc...)
Thanks
|
|
edderic
Newbie Joined: 19 December 2007 Location: Belgium Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Now its working,thanks Rafael
Eric
|
|
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 |