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

Populating Calendar

 Post Reply Post Reply
Author
Message
johnp View Drop Down
Groupie
Groupie
Avatar

Joined: 21 February 2008
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote johnp Quote  Post ReplyReply Direct Link To This Post Topic: Populating Calendar
    Posted: 28 August 2009 at 9:56am
I am having a real problem with speed on the calendar control. I am using data from an sql table with the custom data provider to get events. The calendar is making a separate call to the table for each day in the date picker. Is there not a way to make one call to the table and select all of the events at one time?
Back to Top
phainge View Drop Down
Groupie
Groupie
Avatar

Joined: 03 July 2009
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote phainge Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2009 at 10:30am
Hi johnp,

The calendar control should only be reading appointments for the currently visible date range that aren't already cached.  The following properties expose the date range that is selected in the calendar control:

CalendarControl.ActiveView.Selection.Begin
CalendarControl.ActiveView.Selection.End
 
You can use the date range to read the matching appointments from the database into a recordset, and then have the calendar control populate itself from the recordset rather than the database.  That means each time the calendar view changes you are only performing one read from the database instead of multiple reads, which should speed things up.
 
Peter
Xtreme SuitePro (ActiveX) 15.1.3
Windows 7 Pro (64bit) SP1
Visual Basic 6.0 SP4
Back to Top
johnp View Drop Down
Groupie
Groupie
Avatar

Joined: 21 February 2008
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote johnp Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2009 at 10:48am

phainge, thanks for the feedback. I am reading data into a recordset and using the recordset to populate the calendar control. I am sure that I am overlooking something obvious but, in my code I execute the following:

CalendarControl.Populate

This leads to a call to the following Private sub, once for each day shown (6 months worth) on the datepicker.

Private Sub m_pCalendar_DoRetrieveDayEvents(ByVal dtDay As Date, ByVal pEvents As xtremecalendarcontrol.CalendarEvents)

Are you suggesting that I set selection.begin and selection.end values to a single date so that this sub only gets called once and modify my recordset source statement to select the range of dates that I want?
Back to Top
phainge View Drop Down
Groupie
Groupie
Avatar

Joined: 03 July 2009
Status: Offline
Points: 20
Post Options Post Options   Thanks (0) Thanks(0)   Quote phainge Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2009 at 10:59am

johnp,

When you call the Populate method, it will fire the The DoRetrieveDayEvents event for each day in the current view - this event is designed to read the appointments for just one day, so in order to be able to read the appointments for multiple days (i.e. the currently selected date range) you will need to put code in the calendar control SelectionChanged event to read all of the matching appointments (for the current date range) from the database into the recordset, then when you call the Populate method the code in the DoRetrieveDayEvents event will read just the appointments for that day from the recordset.  So it will be the SelectionChanged event that reads the appointments from the database, not the DoRetrieveDayEvents event.
 
Peter
Xtreme SuitePro (ActiveX) 15.1.3
Windows 7 Pro (64bit) SP1
Visual Basic 6.0 SP4
Back to Top
johnp View Drop Down
Groupie
Groupie
Avatar

Joined: 21 February 2008
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote johnp Quote  Post ReplyReply Direct Link To This Post Posted: 28 August 2009 at 11:10am
Thanks again phainge...  I will give that a try. Appreciate your quick response.
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.