TierFormat And TierApperance
Details
Date:2/15/2013 9:48:00 AM
Product:ActiveGanttVBA Gantt Chart / Scheduler Component
Framework:.Net Framework 4.0 / Visual Studio 2010
Version:2.9.3
User's Development Environment:Visual Basic .Net 2010
Subject:TierFormat.MonthIntervalFormat not applied
Question

I have this code to display the time line:


        oView = ActiveGanttVBACtl1.Views.Add(E_INTERVAL.IL_HOUR, _
                                             12, _
                                             E_TIERTYPE.ST_YEAR, _
                                             E_TIERTYPE.ST_MONTH, _
                                             E_TIERTYPE.ST_MONTH)

        With oView
            .TimeLine.TierArea.TierFormat.YearIntervalFormat = "yyyy"
            .TimeLine.TierArea.TierFormat.MonthIntervalFormat = "MMM"
            .TimeLine.TierArea.UpperTier.Height = 17
            .TimeLine.TierArea.MiddleTier.Visible = False
            .TimeLine.TierArea.LowerTier.Height = 17
            .TimeLine.TickMarkArea.Visible = False
        End With

        ActiveGanttVBACtl1.CurrentView = oView.Index.ToString()

The UpperTier display are OK with year in format 2013, 2014, etc...

The LowerTier display doesn't display the right format. I nead "janv." for the month but he display "janvier 2013". I set the ".TimeLine.TierArea.TierFormat.MonthIntervalFormat = "MMM" and it 's not aplied.

Why???

Answer

Answer:

The defaults for the control are:


        ActiveGanttVBACtl1.TierAppearanceScope = E_TIERAPPEARANCESCOPE.TAS_CONTROL
        ActiveGanttVBACtl1.TierFormatScope = E_TIERFORMATSCOPE.TFS_CONTROL

Which means that all the views will use the values contained in:


        ActiveGanttVBACtl1.TierAppearance
        ActiveGanttVBACtl1.TierFormat

But in this case what you need is for the view to take values from:


        oView.TimeLine.TierArea.TierAppearance
        oView.TimeLine.TierArea.TierFormat

So you have to set the properties to:


        ActiveGanttVBACtl1.TierAppearanceScope = E_TIERAPPEARANCESCOPE.TAS_VIEW
        ActiveGanttVBACtl1.TierFormatScope = E_TIERFORMATSCOPE.TFS_VIEW

I've only included TierAppearance & TierAppearanceScope because they work in exactly the same way.

This applies to all technology/language versions of the control and not just ActiveGanttVBA.

 

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.