10488 : how do I set the scaler so that it shows only the days ma/tue/ etc… and that it does not scale otherwise (no hours / minutes /weeks) or months ???

Question

how do I set the scaler so that it shows only the days ma/tue/ etc… and that it does not scale otherwise (no hours / minutes /weeks or months) ???

Answer

phGant VCL version

First you need to find a Scale that you like presentation wise. Once you have it (Check the phGantt.Scale property in runtime when you have the Gantt set the way you want).

Use the decided scale value in the DateScaler.OnLimitScaling event. Simply return false when the Scale value differs from your constant.

 

10449 : How can I tell which nodes in my tree are visible to the user?

Question

How can I tell which nodes in my tree are visible to the user?

When the user expands a node, I would like to be able to adjust the display so that all the sub-nodes of that node are visible (without the user having to scroll up or down to see them).

Or is there a way of getting the Gant control to adjust the display automatically? I would ideally like the tree to work like the tree in Windows Explorer.

Answer

Both the phGantTimePackage and GTP.NET returns a rectangle of -1,-1,-1,-1 for the grid rect of cells that has not been drawn (because they are not currently on screen).

In phGantTimePackage you can use the IphGantRow3.GetRect method
and in GTP.NET you would use GridNode.Rect

The same applies to individual cells (that they return a -1 rect if not currently on screen).

10425 : Access to UserIntegerReference

Question

When i populate the gant control, i am using the UserIntegerReference property to hold the primary key value for each database record that i add to the control. As each timebar record is added to the gant, i also record the value in a cursor with its “current dates”.

When a user moves or resizes a timebar, how do I determine the UserIntegerReference value of the selected timebar? I need to take that value and lookup the assigned “UserIntegerReference” value in my database, in order to perform some validations and to show additional data.

In the OnValueChangedGantTime method, I want to use this “UserIntegerReference” to perform the lookup. But i am missing the obvious. Can you help?

Answer

The OnValueChangedGantTime gives you a parameter named theDataEntity, of the type IphdataEntity_GantTime.

If you store your db-key in the UserIntegerReference you can access it with theDataEntity.UserIntegerReference.

If you stored the key in the tree nodes UserIntegerReference you can access it like this:
((theDataEntity as IphDataEntity_GantTime2).Row as IphGantRow3).TreeNode.UserIntegerReference

10410 : phGantTimePackage in Access??

Question

I am currently evaluating phGantTimePackage for potential use within Access applications, but I cant find any documentation or examples that show how to get events working within an access application.  Is this possible?

Answer

Yes, the phGantTimePackage works in all activex supporting development environments. (Access, VFP, PowerBuilder, Delphi, VisualStudio) .

The bulk of the ActiveX samples are made with VB6.

Disclaimer: We offer very little special knowledge about each individual environment.

10379 : Does the phGantTimePackage support the export of the GantTime to PowerPoint?

Question

Does the phGantTimePackage support the export of the GantTime to PowerPoint?

Answer

Not powerpoint directly. BUT since win32 and .NET allowes for recording of meta files by sending in a graphic context, you can use win32 features and create a meta file hdc and use the PrintToHdc. PowerPoint handles meta files (emf and wmf) and files created this way are vector based so they scale nicely.

10333 : Is there anyway the text can be placed outside the time object so when a print is performed the whole text can be seen?

Question

Using phGantTime and printing. We have text displayed in the time object. If the object is small then the text is truncated and cannot be seen on a printout. Is there anyway the text can be placed outside the time object so when a print is performed the whole text can be seen?

Answer

The latest patch has new functionality to render time item texts outside their time items.

You go like this to use it:

Private Sub addRow(textplacex As TxTextRectPlace, textplacey As TxTextRectPlace)
Dim de As IphDataEntity_Tree
Dim gr As IphGantRow3
Dim gt As IphDataEntity_GantTime2

If phGantX1.CurrentDataEntityTree Is Nothing Then
    Set de = phGantX1.AddRootDataEntityTree
  Else
    Set de = phGantX1.AddDataEntityTree(phGantX1.CurrentDataEntityTree)
  End If
 
  i = i + 1
  de.Text = “<new row>” + Str(i)
  Set gr = de.GantRow
  gr.TimeItems_CanChangeRow = False
  gr.TimeItems_CanMove = True
 
  Set gt = phGantX1.AddGantTime(de, 0)
  gt.Style = tsNormal
  gt.Start = Date
  gt.Stop = Date + 5
 
  gt.TimeItemsTextAdd
  gt.TimeItemsTextSetEx 0, de.Text, 2, 2, 0, textplacex, textplacey
         

End Sub

And the TxTextRectPlace type can have these values trpInside,trpOutsideNear,trpOutsideFar

 

 

10688 : Critical path

Question

Does the phGantTimePackage and GTP.NET calculate the Critical Path?

Answer

WikiPedia on Critical path:

“The Critical Path Method, abbreviated CPM, is a mathematically based algorithm for scheduling a set of project activities. It is a very important tool for effective project management. It was developed in the 1950’s in a joint venture between DuPont Corporation and Remington Rand Corporation for managing plant maintenance projects. Today, it is commonly used with all forms of projects, including construction, software development, research projects, product development, engineering, plant maintenance, among others. Any project with interdependent activities can apply this method of scheduling.

The essential technique for using CPM is to construct a model of the project that includes the following:

A list of all activities required to complete the project,
The time (duration) that each activity will take to completion, and
The dependencies between the activities.
Using these values, CPM calculates the starting and ending times for each activity, determines which activities are critical to the completion of a project (called the critical path), and reveals those activities with “float time” (are less critical). In project management, a critical path is the sequence of project network activities with the longest overall duration, determining the shortest time possible to complete the project. Any delay of an activity on the critical path directly impacts the planned project completion date (i.e. there is no float on the critical path). A project can have several, parallel critical paths. An additional parallel path through the network with the total durations shorter than the critical path is called a sub-critical or non-critical path.”

Our components are used in many different types of applications and even when they are used for strict project planning it is common that multiple types of time items are used that symbolize different aspects of time. Planned time is only one aspect. Work time can be another (the actual performed work amount). And scheduled time can be a third (when the resource is available for any work at all).

So to simply say that we support a Critical Path analysis would not be correct. We do however support the harbouring of all the information needed to perform Critical Path calculations in what ever application you may build and this is what is important to us.

Critical Path calculation is to us only another domain specific usage of the information presented by the GTP.NET and the phGantTimePackage. You can easily go from one TimeItem to another over its timeItemLinks (relations) and you can easily add logic to iterate these paths and perform actions (like actually moving overlapping timeItems etc) or present bottlenecks by changing the presentation any way you may require (color, form and content).

 

10524 : Does the phGantXControl OCX support UNICODE?

Question

Does the phGantXControl OCX support UNICODE?

I use the method SetGridCellString passing a unicode string, but I see only question marks.

Answer

Yes the phGantTimePackage fully handles UNICODE characters. You will need fonts on your machine to represent the data you are trying to show.

Test it like this. Go to www.google.jp (japan), if you have the japan fonts you see soma japanese text, if you do not have the fonts you will see squares (or garbarge). If you see kanji text Copy it, and paste it in to the Grid. You should find that the grid keeps the kanji letters just like it should.

10484 : How can I iterate trough all the rows of the grid and gantt rows then save them to a database and later on read them in again. VCL

Question

I just received my legal copy of phgant vcl component. I am missing a serious help file.

How can I iterate trough all the rows of the grid en gantt rows en save them to a database and later on read them in again. I know how to use the database component but I don’t see a way to iterate through all the items An small exemple for delphi vcl please

Answer

We are sadly aware of the poor state of the help file; we have been a bit surprised by the recent revival of the phGantTimePackage for VCL. Of course we will make up for it by answering all question swiftly;

One possible way to bridge the gap between the ActiveX help file and knowledgebase and the VCL version is to look at the “glue” files that wrap the VCL version to create the ActiveX.
You can then directly see what internal VCL calls that are made to get a certain ActiveX call. Email support if you want access to these pas files

This code iterates the complete Gantt (instanse called G1)


procedure TForm1.ButtonIterateClick(Sender: TObject);

  procedure IterateCellsInANode(aGridRow:TAxisContentItem);
  var
    x:integer;
  begin
    for x:=0 to G1.Grid.CellCountX-1 do
    begin
      G1.Grid.GetText(G1.Grid.Cell[x,aGridRow.ListIndex]);
    end;
  end;

  procedure IterateGanttRowContent(aGantRow:TGantRow);
  var
    i,ii:integer;
    aTimeItem:TphDataEntity_GantTime;
  begin
    // Iterate layers
    for i:=0 to aGantRow.DataLists.Count-1 do
    begin
      // for each layer iterate time items
      for ii:=0 to aGantRow.DataLists.Items[i].Count-1 do
      begin
        aTimeItem:=aGantRow.DataLists.Items[i].Items[ii] as TphDataEntity_GantTime;
        aTimeItem.Start:=aTimeItem.Start+1; // Just change something so that we see that we have been here
        aTimeItem.Stop:=aTimeItem.Stop+1;
      end;

    end;
  end;

  procedure IterateNode(aNode:TphDataEntity_GridTreeNode);
  var
    i:integer;
  begin
    // Iterate sub nodes of this node
    for i:=0 to aNode.SubDataList.Count-1 do
    begin
      IterateNode(aNode.SubDataList[i] as TphDataEntity_GridTreeNode);
    end;
    IterateCellsInANode(aNode.AxisContentItem);
    IterateGanttRowContent(G1.RowList.FindRowFromGridNode(aNode));
  end;


var
  i:integer;
begin
  // Iterate root nodes from the grid tree
  for i:=0 to G1.Grid.GetTree.RootDataEntities.Count-1 do
  begin
    IterateNode(G1.Grid.GetTree.RootDataEntities[i] as TphDataEntity_GridTreeNode);
  end;
  G1.GA.Invalidate; // Invalidate the Gantt area to show changes

end;