Select an event in the calender |
Post Reply |
Author | |
paul_ont
Newbie Joined: 24 February 2008 Location: Canada Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 24 February 2008 at 12:23pm |
Is there any way programmatically select an event in the calender, highlighting the event the same way as it would if you manually selected the event in the control?
|
|
dentor
Senior Member Joined: 30 November 2005 Location: France Status: Offline Points: 102 |
Post Options
Thanks(0)
|
Hello,
You can use SelectViewEvent Method to select or unselect an event.
|
|
paul_ont
Newbie Joined: 24 February 2008 Location: Canada Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Thanks.. still can't figure out how to get the selectviewevent to work.. Can anyone post an example using the selectviewevent selecting an event by its ID.
|
|
dentor
Senior Member Joined: 30 November 2005 Location: France Status: Offline Points: 102 |
Post Options
Thanks(0)
|
For the SelectViewEvent method, we must specify a ViewEvent and not an Event, so we must retrieve the ViewEvent in the ActiveView of the Calendar.
If we suppose to have the Event display on the calendar, and you get the day and the id property of the event, this sub find it on the ActiveView and select it:
Sub SelectThisEvent(FindDt As Date, FindId As Long)
Dim ViewEvt As CalendarViewEvent, i As Long, Ndx As Long With Calendar Ndx = -1 For i = 0 To .ActiveView.DaysCount - 1 If .ActiveView(i).Date = DateValue(FindDt) Then Ndx = i Exit For End If Next If Ndx > -1 Then
For Each ViewEvt In .ActiveView(Ndx) If FindId = ViewEvt.Event.Id Then .ActiveView.SelectViewEvent ViewEvt, True End If Next End If End With End Sub |
|
paul_ont
Newbie Joined: 24 February 2008 Location: Canada Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Thanks for the help.. That worked..
|
|
ericl
Newbie Joined: 06 February 2008 Location: France Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Very nice ! Where did you find in the help file that you can give an index to Calendar.ActiveView ? In the 11.2.2 calendarcontrol help file i see : Public Property ActiveView() As CalendarView So i can't imagine we give an index to this method ?! Thanks for your help eric l. |
|
dwise
Newbie Joined: 23 January 2008 Status: Offline Points: 6 |
Post Options
Thanks(0)
|
Small addition, another way to select an event by it's key:
Private Sub SelectEventInView(ByRef prmCalendar As XtremeCalendarControl.CalendarControl, prmAgendaId As Long)
Dim objViewGroup As XtremeCalendarControl.CalendarViewGroup Dim objViewEvent As XtremeCalendarControl.CalendarViewEvent For Each objViewGroup In prmCalendar.ActiveView(0).ViewGroups For Each objViewEvent In objViewGroup.ViewEvents If objViewEvent.Event.id = prmAgendaId Then objViewEvent.Selected = True End If Next Next End Sub Note: apparantly this only works if the view is set to week or day view.
|
|
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 |