Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - help with GetEvent
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

help with GetEvent

 Post Reply Post Reply
Author
Message
palaman View Drop Down
Newbie
Newbie


Joined: 05 February 2009
Location: Spain
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote palaman Quote  Post ReplyReply Direct Link To This Post Topic: help with GetEvent
    Posted: 05 February 2009 at 7:52am
Hi all. I'm having troubles trying to understand the GetEvent method. It's suppossed with this method I'm able to get an event from its ID. I'm using MySql database (within a vb6 projet with the classess Codejock provides to help with). Everything works fine except a behavior that I don't understand. I'll briefly explain it (the code at the bottom):

oScheduler = calendar control
frmAppointment = event creator/editor
frmSelectSeries = edit-delete series or recurrence selector

My point is to get EventID (mysql table EventID field from specific event) from Dataprovider.Event.Id so I can pass it to my own edit event function as a parameter. But "oHitTest.ViewEvent.Id" gets a totally different ID than database does. E.g If database EventID = 3... oHitTest.ViewEvent.Id = -1655 or something else (I assume this unique-number is generated randomly when the events are loaded into the calendar object each time it is created.)

If I use debbuger panel to manually get "oScheduler.Dataprovider.GetEvent(3).Id" then it works fine and it returns  "3" as Id.

My question is, Is this working fine? If affirmative, then how can I use the Event.Id property to get the *real* ID (EventID from database) and not that random ID when I doubleclick on an event??

I hope you understand, and thank you in advance.

---------------------------code----------------------------

Private Sub oScheduler_DblClick()
    Dim oHitTest As CalendarHitTestInfo
    Set oHitTest = oScheduler.ActiveView.HitTest
   
    If oHitTest.ViewEvent Is Nothing Then
        Call frmAppointment.NewRecord(Me) 'click on blank, create new Record
    Else
        If oHitTest.ViewEvent.Event.RecurrenceState <> xtpCalendarRecurrenceNotRecurring Then
            Call frmSelectSeries.ChooseOccurrence(oHitTest.ViewEvent.Event.Subject, False)
            Select Case frmSelectSeries.lngResponse
                Case Is = 0 ' press cancel
                Case Is = 1 'only this recurrence
                    Call frmAppointment.EditRecord(oHitTest.ViewEvent.Event.ID, Me, 1)
                Case Is = 2 'edit whole series
                    Call frmAppointment.EditRecord(oHitTest.ViewEvent.Event.ID, Me, 2)
            End Select
        Else
            Call frmAppointment.EditRecord(oHitTest.ViewEvent.Event.ID, Me, 0)
        End If
    End If
    Set oHitTest = Nothing
End Sub


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