Populating Calendar |
Post Reply |
Author | |
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
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?
|
|
phainge
Groupie Joined: 03 July 2009 Status: Offline Points: 20 |
Post Options
Thanks(0)
|
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 |
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
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?
|
|
phainge
Groupie Joined: 03 July 2009 Status: Offline Points: 20 |
Post Options
Thanks(0)
|
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 |
|
johnp
Groupie Joined: 21 February 2008 Status: Offline Points: 49 |
Post Options
Thanks(0)
|
Thanks again phainge... I will give that a try. Appreciate your quick response.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |