Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Calendar Deleting an event
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Calendar Deleting an event

 Post Reply Post Reply
Author
Message
PPL1 View Drop Down
Groupie
Groupie


Joined: 10 April 2006
Location: Canada
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote PPL1 Quote  Post ReplyReply Direct Link To This Post Topic: Calendar Deleting an event
    Posted: 06 October 2008 at 5:44pm
I'm using the Calendar in a VB6 app.
 
I want to be able to get a notice when an event is deleted and possibly cancel it. There is no Cancel parameter in the EventDeletedEx event. How can this be done? Is BeforeEditOperation the way to go? The problem with the BeforeEditOperation, is that on deleting an event, there is NO reference to the event being deleted... Also, this event seems to occur before the user select to delete "the series" or "just this occurrence" so it is kind of useless for recurring events.
 
Also, I'm experiencing a strange behaviour. If the event is NOT recurring, the event still exist in the database while in the EventDeletedEx event. However, if the event has a recurrence and the user selects to delete all recurrences, the event has already been deleted by the time this event is raised!!! I have extra fields in the Event table used for synchronizing some other data and when the event has recurrences, well I can't get those field values as the record no longer exists.
 
This seems like a bug to me.
Back to Top
afy65 View Drop Down
Newbie
Newbie
Avatar

Joined: 12 October 2008
Location: United Kingdom
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote afy65 Quote  Post ReplyReply Direct Link To This Post Posted: 12 October 2008 at 11:17am
Ahh! - Had sort of the same problem as you - was checking some custom properties for conflicts and if found cancel the drag/drop, tell the user of the conflict, and then return the event to is original position.
 
There maybe an easier way of doing this but I could find no documentation anywhere - Anyway
 
Declared a temp event variable at the top of the module.
 
Dim TempEvent As CalendarEvent
 
In the calCalendarEvents_BeforeEditOperation event I added the following:
 
If (OpParams.Operation = xtpCalendarEO_DragMove) And (TempEvent Is Nothing) Then
  Set TempEvent = OpParams.DraggingEvent
End If
 
In the calCalendarEvents_EventChanged event I added the following:
 

 
Private Sub calCalendarEvents_EventChanged(ByVal EventID As Long)
    'declare the local variables here
    Dim locEventInfo As CalendarEvent
    Dim locModifiedEvent As CalendarEvent
    Dim locEventID As Integer
    Dim locStartTime As String
    Dim locEndTime As String
    Dim locAllDay As Boolean
    Dim locPersonsName As String
   
    'catch error and pass to the handler
    On Error GoTo errorHandler
   
        Set locEventInfo = calCalendarEvents.DataProvider.GetEvent(EventID)
        Set locModifiedEvent = locEventInfo
   
        locEventID = locEventInfo.id
        locStartTime = locEventInfo.StartTime
        locEndTime = locEventInfo.endTime
        locAllDay = locEventInfo.AllDayEvent
        locPersonsName = locEventInfo.Subject
   
        'check to see if the event conflicts with any other events
        If Not (checkForConflict(locEventID, locStartTime, locEndTime, locAllDay, locPersonsName)) Then
       
            locModifiedEvent.StartTime = TempEvent.StartTime
            locModifiedEvent.endTime = TempEvent.endTime
            locModifiedEvent.AllDayEvent = TempEvent.AllDayEvent
            locModifiedEvent.BusyStatus = TempEvent.BusyStatus
            calCalendarEvents.DataProvider.ChangeEvent locModifiedEvent
            MsgBox "Appointment conflicts with another appointment on your calendar.   ", vbCritical + vbOKOnly, " Conflict...", "", ZERO
       
        End If
       
        'reset the tempEvent holder
        Set TempEvent = Nothing
   
        'all went well so exit sub here
        Exit Sub
'error handler
errorHandler:
   
End Sub
 
 
Hope this helps - should be fairly easy to modify the code so that the user can cancel an event via a prompt instead of a conflict.  If you need more help then drop me a line. ;-)
 
 
 
Back to Top
PPL1 View Drop Down
Groupie
Groupie


Joined: 10 April 2006
Location: Canada
Status: Offline
Points: 65
Post Options Post Options   Thanks (0) Thanks(0)   Quote PPL1 Quote  Post ReplyReply Direct Link To This Post Posted: 12 October 2008 at 5:20pm
bump
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.078 seconds.