10673 : Hiding rows

Question

I use phGantTime in my application and would like to hide a whole row, so that the user can differentiate between different rows (each row representing an activity). From the help, I found that each IphGantRow3 has a property named “visible”, but this one is read only. How do I set this property in order to hide the row ?

Answer

To completly hide a grid node and its GanttRow from view (but still have it in the component) you can set the HideNode property of the IphDataEntity_Tree2 (TphDataEntity_GridTreeNode in VCL).

To Hide specific time items from view you can set their Visible property.

10669 : Hide non working days

Question

On a calendar I require to post just the days of reel work that means I needn’t to post the week ends and public holidays. So can you please inform me how I can post on the calendar just the working days that I fix myself and finally can you send to me a vb6 code.

Answer

The datescaler can only “hide” specific day types (like all fridays) and not specific days (like 23 february).

When we developed the time hiding functionality we saw that people got confused when there where sporadic days missing. But not when it was consequent (like all fridays).

To hide all fridays you can call SetHiddenDayType 5,true

 

 

 

10854 : Ive got a problem with the AddText of the TextCollection in VCL.

Question

I’ve got a problem with the ‘AddText’ of the ‘TextCollection’.

For exemple after an ‘AddText’ method when i test the ‘TextCollection.Count’ it’s said 0.
I don’t know how to change the text of my ‘TphDataEntity_GantTime’ after i create it.

Answer

The code below adds a text to a time item, and then changes it…

procedure TForm1.Button4Click(Sender: TObject);
begin
  if Assigned(phGant1.ActiveDataEntity) then
  begin
    phGant1.ActiveDataEntity.TextCollection.AddText(‘Hello’,0,0);
    ShowMessage(IntToStr(phGant1.ActiveDataEntity.TextCollection.Count));
    phGant1.ActiveDataEntity.TextCollection.Text[0].Text:=phGant1.ActiveDataEntity.TextCollection.Text[0].Text+’+’;
  end;
end;

10907 : How can I render a custom link when I set the link style to tlsUserDraw?

Question

How can I render a custom link when I set the link style to
tlsUserDraw. Can you supply an example please?

Answer

The first thing to do is to create the link and set its style to User:

Private Sub LinkTimes(theFrom As IphDataEntity_GantTime, theTo As IphDataEntity_GantTime)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Dim aLink As IphDataEntity_Link

Dim aInt As Integer

  

   If (theFrom Is Nothing) Or (theTo Is Nothing) Then

     ‘ Dont do anything

   Else

     Set aLink = phGantX1.AddLink

       

     aLink.LinkOwner = theFrom

     aLink.LinkedTo = theTo

    

     aInt = globalCounter Mod 4

     ‘aLink.LinkStyle = tlsMSProject

     aLink.LinkStyle = tlsUserDraw

    

     aLink.LinkColor = vbBlue

    

     If aInt = 1 Then

       aLink.StartFinishOption = tlsfFS

     ElseIf aInt = 2 Then

       aLink.StartFinishOption = tlsfSS

     ElseIf aInt = 3 Then

       aLink.StartFinishOption = tlsfFF

     ElseIf aInt = 3 Then

       aLink.StartFinishOption = tlsfFS

     End If

     globalCounter = globalCounter + 1

   End If

   Set globalToLinkTo = theTo

End Sub

 

And then you must implement the OnUserDrawLink event and simply draw your link between the start and stop. Mind you that this sample only draws a straight line, and the implementations in the phGantTimePackage does a lot more to bend the line etc.

 

 

 

Private Sub phGantX1_OnUserDrawLink(ByVal theGant As phGantXControl.IphGantX2, ByVal theDataEntity_Link As phGantXControl.IphDataEntity_Link, ByVal theHDC As Long, ByVal Startx As Long, ByVal Starty As Long, ByVal Stopx As Long, ByVal Stopy As Long)

    aDummy = Module1.MoveTo(theHDC, Startx, Starty)

    aDummy = Module1.LineTo(theHDC, Stopx, Stopy)

 

End Sub

 

 

 

11040 : I want to keep the original Height of Some time items…

Question

For the gantrow I have set the property CollisionDetect = True
So on Collision the height of the timeItems are changed (just what I want). But I want to keep the original Height of Some time items because it is another activity. How can I arrange this in VB. Thnx in advance.

Answer

You can set IphGantRow3.CollisionDetectBetweenLayers=false and keep some activities in one layer and the others in another layer.

10844 : phGantXControl.ocx under Vista Home Premium

Question

I’m can not register the phGantXControl.ocx under Vista Home Premium ( I’m using the command :regsvr32 phGantXControl.ocx). The system returns that a call to the DllRegisterServer failed with the error code : 0x80004005. Also (maybe for the same reason?) I can not import this activex into the Delphi 7 IDE. Please help me as I’m in the proccess of migrating my develpment from XP to new vista and I’m faced with many combatibility problems.

Answer

You must run regsvr32 as administrator in Vista. Just start a command prompt and choose “Run as administrator”, then execute regsvr32.

Further info on installing the phGantXControl.ocx in Vista Ultimate. You must have the UAC (the advanced user rights thingy) turned ON.

10665 : How can I put an image (like the example in Yapp) in a TimeLine?

Question

How can I put an image (like the example in Yapp) in a TimeLine?

Answer

In phGantTimePackage you set the IphDataEntity_GantTime2.Style to gtsImage, uses the ImageIndex property to get a Image from the imagelist (same images as from the tree) . Or you can use a userdrawn time item and place an additional icon in there by normal GDI drawing.

In GTP.NET the TimeItemTextLayout has a property for ImageIndex. This enables you to place multiple icons in or outside of a time item.

10619 : Controlling z order of time items

Question

When I add several TimeItems to a Gantt row (where times overlap each other) they all appear; however are split horizontally across the Grid displaying several thin TimeItems.

What I really want, is a single row to be shown, where the last item added will overwrite (appear on top) of the other items. I know I could iterate through the different time items and calculate where each starts/stops to ensure the times don’t overlap (resulting in a single row) but this will take some time.

Can this be achieved by using different Layers?

Answer

First you may turn off the automatic collision detection by setting the IphGantRow3.CollisionDetect=false.

But to further control the z-order of drawing (which time item that is drawn on top of another) you should place your time items on different layers.

If you add a time item to layer zero and one to layer one it would look like this:

layer0_TimeItem=phGantX.AddGantTime(0)
layer1_TimeItem=phGantX.AddGantTime(1)

The deafult drawing order is from 0 to n. You can control where the drawing starts (maybe you want a “send to back” choice on your time item) and this is controlled by the IphGantRow3.DrawLayerStart property.

This is the help file description of the IphGantRow3.DrawLayerStart property

Since there can be many datalists on a GantRow, you can use these different lists as layers. In order to control in wich order the layers are drawn you set the drawLayerStart property. Say that you have 5 layers or datalist. Then they will span from 0 to 4 and normally be drawn 0,1,2,3,4. When you set DrawLayerStart to 3 for exemple they will be drawn in the following order: 3,4,0,1,2.

 

10796 : Dragging between Gantts…

Question

I have two phGants on one form and drag between them and within them. When dragging between the gantts users hold down the cntrl key and when dragging within a single gantt they just drag the mouse. Problem is,, sometimes users forget and hold the control key down when dragging within a single control. The OnOlEDrop event does not trap for it. The senderid is always 0. How can I trap for this and know for sure whether they are dragging between two gantts or within 1 gantt?

Answer

When you recieve your GantTime you can check what phGant that owns in by navigating like this phDataEntity_GantTime.Row.TreeNode, when on the node you must iterate until TreeNode.Parent==nil then the TreeNode.OwningDataList will equal the phGantX.RootDataEntitiesTree for either Gantt1 or Gantt2

 

10649 : Im using phGant VCL version with Delphi 2006 and would like to know how to save the content of the component to a file in order to reload it later ?

Question

I’m using phGant VCL version with Delphi 2006 and would like to know how to save the content of the component to a file in order to reload it later ?

Answer

There is no built in function to persist the component state to disk, and no function to reload. I would suggest that you us a MSXML DOM and iterate the gantt chart and save the objects and properties you want saved in elements and attributes.