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

Selecting an event

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

Joined: 10 August 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomgriff Quote  Post ReplyReply Direct Link To This Post Topic: Selecting an event
    Posted: 31 August 2006 at 1:37am
Hi,
 
I have a problem with selecting an event in the calendar.
 
I have a client database in access.  When I add an appointment in the calendar, I also add the appointment in the Client DB.  I also add the event id to the client db.
 
I show the appointments for each client in a grid on the client info page.
 
I want to dbl-clk on an appointment in the grid and have the calendar open with the appointment selected and centered in  the calendar.
 
I have the calendar opening, and I am using the setselection  to highlight the time for the appointment.  The calendar does not move the select into view if it is late in the day.
 
This is the code I am using on the grid_dbl-clk
 
  frmMain.ShowPanes PANE_APPOINTMENT_CALENDAR
  With frmAppointmentCalendar
    .wndDatePicker.EnsureVisible dteApptDate
    .wndDatePicker.Select dteApptDate
    .calCalendar.ActiveView.ShowDay dteApptDate
    .calCalendar.ActiveView.SetSelection ModEvent.StartTime, ModEvent.EndTime, False
    .calCalendar.RedrawControl
  End With
I am using Calendar 10.2
 
I would appreciate any help.
 
Thanks in advance.
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 8:49am
Hi,

As far as I understand, you're trying to scroll in a Day view (up or down). In this case you should use DayView.ScrollV method.

So, the body of your method could be as follows:

wndDatePicker.EnsureVisible dteApptDate
wndDatePicker.Select dteApptDate
calCalendar.ActiveView.ShowDay dteApptDate
calCalendar.DayView.ScrollV calCalendar.DayView.GetCellNumber(TimeValue(ModEvent.StartTime))
calCalendar.ActiveView.SetSelection ModEvent.StartTime, ModEvent.EndTime, False
calCalendar.Populate


--
WBR,
Serge
Back to Top
tomgriff View Drop Down
Groupie
Groupie
Avatar

Joined: 10 August 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomgriff Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 12:18pm
Hello,
 
Thanks for the help.
 
The DayScroll works perfect for putting the setselection into the calendar veiw when it is late in the day.
 
The thing that is happening is that the appointment (event) is not being selected, the time period behind the appoinment (event) is being selected.  I would like for the actual appointment (event)  to be selected.
 
Once again, thanks for the help.
 
 
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 12:58pm
Ok, if you also want to select this appointment view, add a following piece of code just before calling .Populate:

Dim ve As CalendarViewEvent
For Each ve In calCalendar.ActiveView(0)
    If ve.Event.Id = ModEvent.Id Then calCalendar.ActiveView.SelectViewEvent ve, True
Next


ps: if you also want a top blue selection border to be visible, scroll day view to Cell Number - 1 of event's start time.

--
WBR,
Serge
Back to Top
tomgriff View Drop Down
Groupie
Groupie
Avatar

Joined: 10 August 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomgriff Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 2:55pm
Thanks for the quick response.
 
I will give this a try.
 
This forum is a great resource for the controls.
 
Back to Top
tomgriff View Drop Down
Groupie
Groupie
Avatar

Joined: 10 August 2006
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomgriff Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 7:09pm
Hello again,
 
I tried the code you sent me in the previous reply.
 

 
Dim ModEvent As CalendarEvent
Dim ve As CalendarViewEvent
 
iApptID = NZ(Me.grdClientDataApptDate.ItemData(Me.grdClientDataApptDate.ItemIndex), 0)
lngEventID = CLng(NZ(VLookup("EventID", GetDBName(), "tblDataClientApptDate", "ApptID = " & iApptID), 0))
dteApptDate = NZ(VLookup("ApptDate", GetDBName(), "tblDataClientApptDate", "ApptID = " & iApptID), 0)
Set ModEvent = frmAppointmentCalendar.calCalendar.DataProvider.GetEvent(lngEventID)
If ModEvent Is Nothing Then
  MsgBox "There is a problem with the appointment you are trying to open.", vbCritical + vbOKOnly
Else
  frmMain.ShowPanes PANE_APPOINTMENT_CALENDAR
  With frmAppointmentCalendar
    .wndDatePicker.EnsureVisible dteApptDate
    .wndDatePicker.Select dteApptDate
    .calCalendar.ActiveView.ShowDay dteApptDate
    .calCalendar.DayView.ScrollV .calCalendar.DayView.GetCellNumber(TimeValue(ModEvent.StartTime))
     For Each ve In .calCalendar.ActiveView(0)
      If ve.Event.Id = ModEvent.Id Then .calCalendar.ActiveView.SelectViewEvent ve, True
     Next
    .calCalendar.Populate
  End With
End If
 
it seems that ve is always nothing, the for each loop is not run, so there is no event selected.
 
I must have something wrong here.
 
 
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.