Print Page | Close Window

custom datasource events

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=4231
Printed Date: 23 June 2024 at 3:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: custom datasource events
Posted By: RichardN
Subject: custom datasource events
Date Posted: 17 May 2006 at 11:24am
Hi, I'm just getting started with Xtreme Calendar. I was wondering how the calendar control expects the data to be returned from the custom datasource events. For instance when implementing the DoReadEvent method. I would expect to write something like this (pseudocode):

Private Sub CalendarControl1_DoReadEvent(ByVal EventID As Long, pEvent As XtremeCalendarControl.CalendarEvent)

read recordset for event with id EventID
dim objCalendarEvent as calendarevent
Set objCalendarEvent = new calendarevent
set objcalendarevent properties
.
.
.
.
end properties

set pEvent = objCalendarevent

End Sub


instead, the only way to create a calendarevent object seems to be by referencing the dataprovider object in the calendar control itself.
If this is the case intentionally, how should I go about creating the object? should I use the createeventex method and presumably thereby add it to the calendar's collection of events? If so, why include pEvent as an argument?

Are there any examples of these custom events already being implemented anywhere?

Thanks,
Richard.





Replies:
Posted By: sserge
Date Posted: 17 May 2006 at 3:45pm
Hi Richard,

You're looking in a correct way. Just use DataProvider.CreateEventEx(EventID) method to create event object
instead of using new operator. This is implemented in such way to manage internal references between Event object and data provider which owns this event.

The pseudo code is:
 

Private Sub CalendarControl1_DoReadEvent(ByVal EventID As Long, pEvent As XtremeCalendarControl.CalendarEvent)

      ' read recordset for event with id EventID
 
      dim objCalendarEvent as calendarevent
      Set objCalendarEvent = CalendarControl1.DataProvider.CreateEventEx(EventID)
 
      ' set objcalendarevent properties
      .
      .
      .
      .
      ' end properties

      set pEvent = objCalendarevent

End Sub

 
There are also some other aspects for reccurrence events.
Look at Calendar VB sample, SQL Server example.
 
--
WBR,
Serge


Posted By: RichardN
Date Posted: 18 May 2006 at 4:33am
Thanks for the quick reply, I had a feeling it might work like that, the documentation isn't too clear about the way it should be done. Is that SQL server example available online, because the examples that came with the component don't appear to include any SQL server examples.


Posted By: sserge
Date Posted: 18 May 2006 at 5:27am
It is included in the standard suite installation. See \samples\Calendar\VB\CalendarSample -- SQL Server data provider (providerSQLServer.cls).

--
WBR,
Serge


Posted By: RichardN
Date Posted: 19 May 2006 at 10:49am
Thanks again, that was brilliant. I do have one other problem though. In a multiple schedules environment, is it possible to find out what scheduleid the selected time range is in when creating a new event.

If you look at the example files you can see that this feature is not implemented. Regardless of what schedule you had the selection for the default schedule for a new task is always John.


Posted By: sserge
Date Posted: 23 May 2006 at 5:43pm
Yes, I see that in current sample it's not implemented. However, that's easy - just get this value from HitTest info:

HitTest.ViewGroup.GroupIndex


--
WBR,
Serge


Posted By: RichardN
Date Posted: 24 May 2006 at 4:16am
Yeah, I think you misunderstood my question, I wanted to find out what the schedule ID of the selected range is, not the schedule id of an existing event. This would allow me to make a new task from a selection in the calendar without having to ask the user which schedule it is for.

I phoned tech support yesterday and they say that this is coming in the new release (out friday) under calendarcontrol.activeview.selection.groupindex
Thanks Guys!




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