Print Page | Close Window

Making Sure Event is Visible

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=3021
Printed Date: 27 April 2024 at 10:20pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Making Sure Event is Visible
Posted By: DDJJ
Subject: Making Sure Event is Visible
Date 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




Replies:
Posted By: sserge
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net