HomeProductsSupportDownloadsOnline StoreOnLine DocumentationLicensingAbout UsContact Us

Need technical support or assistance?

Click Here.

Please remember to read our guidelines first.

 

 

You will receive advance information about products and web updates as well as free software and source code that we will soon make available.

Subscribe Now

Once your subscription is activated you will receive instructions on how to leave the list.

 
     
Hundreds of free Visual Basic source code snippets, activeX controls, tutorials, tips, projects and articles covering VB.NET and VB6! Great code on topics like MAPI, winsock programming, COM, MTS, XML, graphics, threading, timers, networking, API's and more!
Welcome to the largest single directory of ASP.NET resources. This free directory links to examples, articles, and tutorials. A searchable code library allows you to find scripts. A daily newsletter keeps you up to date on the latest submissions.
Search the best developer Web sites and hundreds of developer newsgroups... updated every thirty minutes!

TN00012 - Limiting the amount of time shown in the MFC ActiveGantt Scheduler Component

Applies to:
  • ActiveGantt Scheduler Component for Visual C++ 6.0 (MFC ActiveX Control)
Summary:

For certain applications it might be necessary to limit the amount of time shown in the TimeLine like in the following example:

The timeline starts at 12:00 am December 12th, 2001.

And ends at 11:59 am December 12th, 2001.

The user can move between this 24 hour period using the HorizontalScrollBar. Important: using the HorizontalScrollBar is the only method of restricting the amount of time shown in the timeline.

To recreate this behaviour, on a new VB6 form place an MFC ActiveGantt control named ActiveGanttVCCtl1 and the following code:


Option Explicit

Private Sub ActiveGanttVCCtl1_TimeLineChanged()
    Static bLoaded As Boolean
    If bLoaded = False Then
        Dim NumMinutes As Long
        NumMinutes = DateDiff("n", ActiveGanttVCCtl1.TimeLineStart, _
        ActiveGanttVCCtl1.TimeLineEnd)
        ActiveGanttVCCtl1.HorizontalScrollBarStart = #12/12/2001#
        ActiveGanttVCCtl1.HorizontalScrollBarInterval = "n"
        ActiveGanttVCCtl1.HorizontalScrollBarFactor = 5
        ActiveGanttVCCtl1.HorizontalScrollBarSmallChange = 1
        ActiveGanttVCCtl1.HorizontalScrollBarLargeChange = 10
        ActiveGanttVCCtl1.HorizontalScrollBarMax = ((1440 / 5) - (NumMinutes / 5))
        ActiveGanttVCCtl1.HorizontalScrollBarEnabled = True
        bLoaded = True
    End If
End Sub

Because of the way the MFC control is drawn it cannot calculate the value of TimeLineEnd in a Form_Load procedure, so the bLoaded variable becomes necessary and the TimeLineChanged event must be used.

In this case in particular, the ActiveGantt Control will display a 24-hour period beginning on 12/12/2001 12:00AM and ending just before 12/13/2001. 1440 is the number of minutes in 24 hours, the horizontal scroll bar moves in increments of 5 minutes (because of the HorizontalScrollBarFactorproperty), and the max property setting is determined by the amount of minutes in a 24h period (divided by the HorizontalScrollBarFactor) minus the NumMinutes variable (again divided by the HorizontalScrollBarFactor).

Home | Products | Support | Downloads | OnLine Store

Online Documentation | Licensing | About Us | Contact Us

Privacy Terms of use Copyright (c)2002-2004 Source Code Store. All trademarks are property of their legal owner.