Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Making Sure Event is Visible
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Making Sure Event is Visible

 Post Reply Post Reply
Author
Message
DDJJ View Drop Down
Senior Member
Senior Member


Joined: 13 December 2004
Status: Offline
Points: 143
Post Options Post Options   Thanks (0) Thanks(0)   Quote DDJJ Quote  Post ReplyReply Direct Link To This Post Topic: Making Sure Event is Visible
    Posted: 12 October 2005 at 12:36pm

We are setting up a Calendar control to give our users the option of using the control to change the times for a specific event by dragging an event, or by using the mouse to drag the start or end times of an event.  The code we've been trying is shown below.

Two problems.  When our form opens up, the calendar control is frequently not visible.  When I click on the area where the calendar control should be, it shows up, but not until then.  ???

Second problem.  We set up the event to be edited by the user in code (see below).  This event could be at the beginning of a day or at the end, so we want the control to scroll forward to make sure the event is visible to the user.  What we're doing is not working...any ideas why not?

ConnectionString = "Provider=XML;Data Source=" & App.Path & "\Events.xml"
   
    With CalendarControl1
        .SetDataProvider ConnectionString
        If Not .DataProvider.Open Then
             .DataProvider.Create
        End If
        .DataProvider.RemoveAllEvents  'We don't want previously saved events
        .DataProvider.Save
        .Options.FirstDayOfTheWeek = g_lFirstDayOfWeek
        .DayView.TimeScale = g_lTimeScale
        .Options.WorkDayStartTime = TimeValue(g_sStartTime)
        .Options.WorkDayEndTime = TimeValue(g_sEndTime)
    End With
   
    DatePicker1.MaxSelectionCount = 1
    DatePicker1.AttachToCalendar CalendarControl1

    CalendarControl1.ActiveView.ShowDay CDate(cbpStartDate.Text), True
   
    Set m_oEvent = CalendarControl1.DataProvider.CreateEvent
   
    m_oEvent.StartTime = cbpStartDate.Text & " " & cbpTimes(0).Text
    m_oEvent.EndTime = cbpStartDate.Text & " " & cbpTimes(1).Text

    CalendarControl1.DataProvider.AddEvent m_oEvent

    CalendarControl1.Populate
    'CalendarControl1.DayView.ScrollToWo rkDayBegin 'We CAN get this line to      work
'We CAN'T get the following to work
'        Dim lCellNo As Long
''        lCellNo = CalendarControl1.DayView.GetCellNumber(CDate("10/9/2005 1:00:00 PM"))
''        CalendarControl1.ActiveView.EnableVScroll True
''        CalendarControl1.DayView.ScrollV lCellNo

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: 14 October 2005 at 1:57pm
Hi,

1. First problem looks strange, but see the next point...

2. Use one more quite useful method of calendar: RedrawControl.

   Some methods of calendar don't redraw control automatically to avoid "blinking" during adjusting.

3. Suggestion:
   If you don't need to save events - You do not need these lines of code, because calendar is created by default with memory data provider.

   May be .DataProvider.RemoveAllEvents is usefull - depending of your form using.

     ConnectionString = "Provider=XML;Data Source=" & App.Path & "\Events.xml"
    
        .SetDataProvider ConnectionString
        If Not .DataProvider.Open Then
               .DataProvider.Create
        End If
        .DataProvider.RemoveAllEvents 'We don't want previously saved events
        .DataProvider.Save

--
HTH,
Serge
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.