Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Release the DrogDrop Event
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Release the DrogDrop Event

 Post Reply Post Reply
Author
Message
McKloony View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 January 2007
Location: Germany
Status: Offline
Points: 340
Post Options Post Options   Thanks (0) Thanks(0)   Quote McKloony Quote  Post ReplyReply Direct Link To This Post Topic: Release the DrogDrop Event
    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
Back to Top
Rafael View Drop Down
Newbie
Newbie
Avatar

Joined: 26 November 2007
Location: United States
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rafael Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2007 at 4:44pm
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.
 
 
Back to Top
Rafael View Drop Down
Newbie
Newbie
Avatar

Joined: 26 November 2007
Location: United States
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rafael Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2007 at 4:49pm

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.
Back to Top
McKloony View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 January 2007
Location: Germany
Status: Offline
Points: 340
Post Options Post Options   Thanks (0) Thanks(0)   Quote McKloony Quote  Post ReplyReply Direct Link To This Post Posted: 27 November 2007 at 1:29am
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
Back to Top
Rafael View Drop Down
Newbie
Newbie
Avatar

Joined: 26 November 2007
Location: United States
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rafael Quote  Post ReplyReply Direct Link To This Post Posted: 27 November 2007 at 10:18am

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.
Back to Top
edderic View Drop Down
Newbie
Newbie


Joined: 19 December 2007
Location: Belgium
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote edderic Quote  Post ReplyReply Direct Link To This Post Posted: 19 December 2007 at 10:03am
Have you a sample (code) how to drag and drop from a grid to the calendarcontrol ?
 
Thanks
Back to Top
Rafael View Drop Down
Newbie
Newbie
Avatar

Joined: 26 November 2007
Location: United States
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rafael Quote  Post ReplyReply Direct Link To This Post Posted: 19 December 2007 at 11:59am
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.
Back to Top
edderic View Drop Down
Newbie
Newbie


Joined: 19 December 2007
Location: Belgium
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote edderic Quote  Post ReplyReply Direct Link To This Post Posted: 19 December 2007 at 2:45pm
it is not working with sharpgrid Oledrag !
 
have you some code from a grid ? (vbbegindrag etc...)
 
Thanks
Back to Top
edderic View Drop Down
Newbie
Newbie


Joined: 19 December 2007
Location: Belgium
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote edderic Quote  Post ReplyReply Direct Link To This Post Posted: 21 December 2007 at 6:54am
Now its working,thanks Rafael
 
Eric
 
 
Originally posted by Rafael Rafael wrote:

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