Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Select an event in the calender
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Select an event in the calender

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


Joined: 24 February 2008
Location: Canada
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote paul_ont Quote  Post ReplyReply Direct Link To This Post Topic: Select an event in the calender
    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?
Back to Top
dentor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2005
Location: France
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote dentor Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2008 at 1:03pm
Hello,
 
You can use SelectViewEvent Method to select or unselect an event.
 
Back to Top
paul_ont View Drop Down
Newbie
Newbie


Joined: 24 February 2008
Location: Canada
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote paul_ont Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2008 at 7:43pm
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. 
Back to Top
dentor View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2005
Location: France
Status: Offline
Points: 102
Post Options Post Options   Thanks (0) Thanks(0)   Quote dentor Quote  Post ReplyReply Direct Link To This Post Posted: 25 February 2008 at 3:16am
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
 
Back to Top
paul_ont View Drop Down
Newbie
Newbie


Joined: 24 February 2008
Location: Canada
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote paul_ont Quote  Post ReplyReply Direct Link To This Post Posted: 28 February 2008 at 5:59pm
Thanks for the help..  That worked..
Back to Top
ericl View Drop Down
Newbie
Newbie


Joined: 06 February 2008
Location: France
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ericl Quote  Post ReplyReply Direct Link To This Post Posted: 29 February 2008 at 3:51am

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.

Back to Top
dwise View Drop Down
Newbie
Newbie


Joined: 23 January 2008
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote dwise Quote  Post ReplyReply Direct Link To This Post Posted: 18 March 2008 at 4:04am
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.
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.