View objects in the Gantt Chart
Details
Date:4/20/2009 4:28:01 AM
Product:ActiveGanttVB Scheduler Component
Framework:Visual Studio 6.0
Version:2.7.3
User's Development Environment:XBase++
Subject:Questions on views
Question

The View.Add() and the Timeline behaviour is very difficult to understand. Please could you give me the code for following scenarios so I can trace it back.

1. I want the timeline only with month and day without a tickMarkArea.

2. I want the timeline only month and day with a tickMarkArea whereby ActiveGanttVBCtl1:Views:Add("15n", "1h", ST_MONTH, ST_WEEK, ST_DAY, "NV") and the tickmarks are set for 6 am, 12, 18 pm, 12 pm as big and 3 am, 9 am, 3 pm, 9 pm as small.

3. the help writes for the 2nd Views:Add parameter "...for each notch on the horizontal axis..." What does notch mean?

4. I want to write my own code for upper, middle and lower tier area.


    ActiveGanttVBCtl1.Views.Add "12h", "1m", ST_CUSTOM, ST_CUSTOM, ST_CUSTOM
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.UpperTier.Interval = "1q"
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.UpperTier.Height =
17
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.MiddleTier.Interval
= "1m"
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.MiddleTier.Height =
17
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.LowerTier.Interval = "1m"
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.LowerTier.Height =
17

Private Sub ActiveGanttVBCtl1_CustomTierDraw(ByVal Position As ActiveGanttVB.E_TIERPOSITION, ByVal StartDate As Date, ByVal EndDate As Date, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long, ByVal LeftTrim As Long, ByVal RightTrim As Long, ByVal lHdc As Long, Caption As String, StyleIndex As String)
    If Position = SP_LOWER Then
        StyleIndex = "TimeLineTiers"
        Caption = ActiveGanttVBCtl1.StrLib.StrFormat(StartDate, "mmm")
        
    ElseIf Position = SP_MIDDLE Then
        StyleIndex = "TimeLineTiers"
        Caption = ActiveGanttVBCtl1.StrLib.StrFormat(StartDate, "mmm")
    
    ElseIf Position = SP_UPPER Then
        StyleIndex = "TimeLineTiers"
        Caption = ActiveGanttVBCtl1.MathLib.GetYear(StartDate) & " Q" &
ActiveGanttVBCtl1.MathLib.GetQuarter(StartDate)
    End If
End Sub

In this sample the SP_MIDDLE isn't invoked. Why?

Answer

Answer:

1. I want the timeline only with month and day without a tickMarkArea.


ActiveGanttVBCtl1.Views.Add "30n", "1h", E_TIERTYPE.ST_MONTH, ST_WEEK, E_TIERTYPE.ST_DAY, "NV"
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.Visible = False
ActiveGanttVBCtl1.CurrentView = "NV"

The above code will produce the following output:

2. I want the timeline only month and day with a tickMarkArea whereby ActiveGanttVBCtl1:Views:Add("15n", "1h", ST_MONTH, ST_WEEK, ST_DAY, "NV") and the tickmarks are set for 6 am, 12, 18 pm, 12 pm as big and 3 am, 9 am, 3 pm, 9 pm as small.


ActiveGanttVBCtl1.Views.Add "15n", "3h", E_TIERTYPE.ST_MONTH, ST_WEEK, E_TIERTYPE.ST_DAY, "NV"
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.Visible = True
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 0, TLT_BIG, False, "", False
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 3, TLT_MEDIUM, False, "", False
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 6, TLT_BIG, False, "", False
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 9, TLT_MEDIUM, False, "", False
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 12, TLT_BIG, False, "", False
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 15, TLT_MEDIUM, False, "", False
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 18, TLT_BIG, False, "", False
ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TickMarkArea.TickMarks.Add 21, TLT_MEDIUM, False, "", False

The above code will produce the following output:

3. the help writes for the 2nd Views:Add parameter "...for each notch on the horizontal axis..." What does notch mean?

Notches are these vertical lines:

4. I want to write my own code for upper, middle and lower tier area.


    ActiveGanttVBCtl1.Views.Add "12h", "1m", ST_CUSTOM, ST_CUSTOM, ST_CUSTOM
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.UpperTier.Interval = "1q"
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.UpperTier.Height =
17
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.MiddleTier.Interval
= "1m"
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.MiddleTier.Height =
17
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.LowerTier.Interval = "1m"
    ActiveGanttVBCtl1.Views.Item("1").TimeLine.TierArea.LowerTier.Height =
17

Private Sub ActiveGanttVBCtl1_CustomTierDraw(ByVal Position As ActiveGanttVB.E_TIERPOSITION, ByVal StartDate As Date, ByVal EndDate As Date, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long, ByVal LeftTrim As Long, ByVal RightTrim As Long, ByVal lHdc As Long, Caption As String, StyleIndex As String)
    If Position = SP_LOWER Then
        StyleIndex = "TimeLineTiers"
        Caption = ActiveGanttVBCtl1.StrLib.StrFormat(StartDate, "mmm")
        
    ElseIf Position = SP_MIDDLE Then
        StyleIndex = "TimeLineTiers"
        Caption = ActiveGanttVBCtl1.StrLib.StrFormat(StartDate, "mmm")
    
    ElseIf Position = SP_UPPER Then
        StyleIndex = "TimeLineTiers"
        Caption = ActiveGanttVBCtl1.MathLib.GetYear(StartDate) & " Q" &
ActiveGanttVBCtl1.MathLib.GetQuarter(StartDate)
    End If
End Sub

In this sample the SP_MIDDLE isn't invoked. Why?

Because the middle tier's visible property is set to false by default, set it to true if you want it to be displayed:


ActiveGanttVBCtl1.Views.Item("NV").TimeLine.TierArea.MiddleTier.Visible = True

 

All trademarks are property of their respective holders, and are only used to directly describe the products and services being provided. Their use in no way indicates any relationship or endorsement between The Source Code Store LLC and the holders of said trademarks.