10588 : Can we make the Today line in real time?

Question

Can we make the Today line update in real time?

Currently I have to move or rescale in the DateTime scaler to get the today line to update. Could this happen in real time?

I have tried using various methods such as Invaildate etc on a timer without success.

Answer

All you need to do is to make sure the TimeItemArea gets invalidated once in a while. Add a timer and in the onTimer event go something like:

gantt1.TimeItemArea.Invalidate();

(for phGantTimePackage you can send an inavlidation message to the handle found here IphGantX3.HWndGantArea)

10557 : Open application on network share.

Question

On opening Gant chart using PTGantChart.ocx control on a network (client m/c), the page crashes giving an Object Not set to reference error and parent pages also crashes. Though the same code with data executes successfully on the server.

Answer

Although not entirely sure that this is your problem the policies for loading and executing applications in non full trust locations (the internet, or a network share) can be restricted by your network administrator. Maybe your administrator has restricted windows from loading unsigned ocx’s from partly trusted locations? You can sign the ocx’s with third party tools.

On the other hand, the ActiveX control must be registered on the client computer with regsvr32 to function, and if you register it on a network share it will get the network path in the registry. If your network path changes (sometimes X:\aaa and sometimes Y:\aaa) that could be an explanation.

10578 : Time from x-coord

Question

Hi I’d like to ask, how to get the Datetime value from a row by having the X coordonate?

I need to implement Drag&Drop from a control to the phGantt(COM version under VB6) and the only one way I found is to use DragOver and DragDrop events. By having the Y value I found the needed row and tree item, how can I find the datetime value where something was droped from that line?

Answer

Once you have the correct x coordinate for the date scaler (you may or may not need to compensate for the grid width etc based on what you are doing ) you send this in to the function IphGantX3.PixelToDate(x:int):TDatetime

10522 : Dependencies between gantt items

Question

Can we create dependencies between gantt items using MS Project method by draying a line from predecessor to successor in the gantt chart?

Answer

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Yes

Set the property IphGantX3.StickyMode=smDependency and the next click on a
time item will draw an outline of a link with IphGantX3.DefaultLinkColor and IphGantX3.DefaultLinkStyle.

To actually create the link object you implement the OnDependencyAction event:

Private Sub phGantX1_OnDependencyAction(ByVal theGant As phGantXControl.IphGantX3, ByVal theStartDataEntity As phGantXControl.IphDataEntity_GantTime2, ByVal theTargetDataEntity As phGantXControl.IphDataEntity_GantTime2)

    Dim aLink As IphDataEntity_Link
    Set aLink = theGant.AddLink
   
    aLink.LinkOwner = theStartDataEntity
    aLink.LinkedTo = theTargetDataEntity
    aLink.LinkStyle = tlsMSProject   

End Sub

 

 

10504 : What is the difference between the classes CphDataEntity_Tree and CphDataEntity_Tree2?

Question

I’m using phGantXControl.ocx

What is the difference between the classes CphDataEntity_Tree and CphDataEntity_Tree2?

I have a CphDataEntity_GantTime item and I want to access to grid rows. It seems that the only way to do this is to use the property GridRowIndex of the class CphDataEntity_Tree2, but I cannot get any CphDataEntity_Tree2 item from my CphDataEntity_GantTime item.

Answer

This is the naming convention when designing a new interface with more functionality: Ix = version one of the interface; Ix2 = version two of the interface.

So CphDataEntity_Tree2 is only a more competent version of

CphDataEntity_Tree.

You can type cast from a CphDataEntity_Tree to a CphDataEntity_Tree2 to access the extended functionality with QueryInterface

This is from the help file, the section called “Understanding interfaces”

Type casting

In VB6 you can do a interface type casting like this:

Dim tn As IphDataEntity_Tree2

  Set tn = theDataEntity.Row.TreeNode

The “theDataEntity.Row.TreeNode” returns a IphDataEntity_Tree but we want to use it as an IphDataEntity_Tree2 in order to reach newer functionality.

In Delphi you would do it like this

tn : IphDataEntity_Tree2;

begin

  tn := theDataEntity.Row.TreeNode As IphDataEntity_Tree2;

 

In VC++ you would do it like this:

CphDataEntity_Tree2  treenode;

       treenode=CphDataEntity_Tree2(theDataEntity.GetRow().GetTreeNode());

.

10360 : phGantTimePackage Virtual load

Question

I am finding Virtual load difficult to use in my project, may be due to lack of knowledge regarding the working of phGantt Chart Virtual View. I am handling task management using the phGantt Chart. Following is the data structure that I have used for managing tasks internally.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

Class CTask
{
      CString m_strTaskName;
      COleDateTime m_dtStartDate;
     
COleDateTime m_dtDueDate;
      
// …. More declarations goes here

      CTaskList   m_SubtaskList; // Sub nodes

};

 

Q1) How and when do I associate CTask* as UserVariant Reference for the nodes?

Q2) I tried using AddDataEntityTree() method for adding subnodes on the callback function? Can’t get it? An example would be appreciable?

 

Answer

I would associate the CTask instance with the TimeItem in the IphGantX3.OnVirtualLoadGrid event, put it in the pointer in the UserIntegerReference.
 
In the IphGantX3.OnVirtualLoadGrid you can add subnodes to the RootNode by calling: IphGantX3.AddDataEntityTree(theRootNode), but I think your problem is with getting the theRootNode corresponding to this virtually loaded row…
 
This is understandable but this what you need to know:
The sent in theRowIndex is the index of the root dataentity tree, so you can access it with IphGantX3.RootDataEntitiesTree(theRowIndex)
 
So you can add subnodes like this:
IphGantX3.AddDataEntityTree(IphGantX3.RootDataEntitiesTree(theRowIndex))
   
 

10761 : Problem when placing the phGantX on windows child form .NET

Question

Hello, I am currently developing an application using your PhGantX control in visual studio 2005, when the application is run and you click on the control to either move the time bar or anything really the application locks on the section as dose not allow you to select anything on the application at all you have to select another window from the desktop to release the form. < ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

This issue has only come up in the studio 2005 application. I previously wrote an app in vb6 and had no problems at all.

I upgraded this app into VS2005 to see if the problem would happen with this one and it did.

Answer

Although the reason for this problem is not entirly understood we know so much that it has to do with win-handles and who is owning who.

The workaround is to place a panel on the child form, and the put the Gantt on the panel…

Creating the mdiChild form is then called when you need to bring the form up:
dim GantForm as form  = new form2
GantForm.mdiparent = me
GantForm.show

 

10552 : How do I to control the links with delphi

Question

How do I to control the links with the VCL version?

Answer

This is a code snippet showing how to enter the link create mode in Delphi. The link create mode (smDependency) allows the user to click one time item and drag out a link to another time item in order to create the depency link:

procedure TForm1.SpeedButtonLinkClick(Sender: TObject);
begin

  // Enter depenency create mode… Will stay in this mode until link created
  phGant1.StickyMode:=smDependency;
end;

procedure TForm1.phGant1DependencyAction(theFirst,
  theSecond: TphDataEntity_GantTime);
var
  aLink:TphDataEntity_Link;
begin

  // Leave the sticky mode
  phGant1.StickyMode:=smNone;

  aLink:=phGant1.AddLink;
  aLink.LinkOwner:=theFirst;
  aLink.LinkedTo:=theSecond;

  aLink.LinkStyle:=phGant1.DefaultLinkStyle;
  aLink.LinkColor:=phGant1.DefaultLinkColor;
  aLink.LinkPenWidth:=phGant1.DefaultLinkPenWidth;

end;

10514 : How I can see a tool tip on a gantt item in VC++ using phGantXControl.ocx?

Question

How I can see a tool tip on a gantt item in VC++ using phGantXControl.ocx?

Answer

Every environment has it own way of controlling tooltip windows so:

There is no built in tooltip in the phGant or phSchema. But if you implement the event IphGantX3.OnHintInfo you will get all the information you normally associate with a ToolTip that might show when dragging a time item.

You need to create and control the tooltip window yourself, decide how it should look and what information etc, then use the OnHintInfo or MouseMove events to bring it up.

 

10737 : How do I add Time items to the phGant in VCL when UseGridNotTree is true?

Question

How do I add Time items to the phGant in VCL when UseGridNotTree is true?

Answer

There are several samples in the general download that shows this.

For example the sample/VCL/Native/Project1 does it like this:

  phGant1.DateScaler.LookAndFeel:=tlfBoxed;
  phGant1.DateScaler.ScrollButtons:=tsbSmall;
  phGant1.UseGridNotTree:=TRUE;

procedure TForm1.Addrow1Click(Sender: TObject);
var
  aGridTreeNode:TphDataEntity_GridTreeNode;
  aCell:TBabCell;
begin

  if Assigned(phGant1.ActiveGantRow) then
    aGridTreeNode:=phGant1.GridNode_Add(phGant1.ActiveGantRow.GridTreeNode)
  else
    aGridTreeNode:=phGant1.GridNode_Add(nil);

  aCell:=phGant1.Grid.Cell[0,aGridTreeNode.AxisContentItem.ListIndex];
  phGant1.Grid.SetText(aCell,’a new row’);

end;

procedure TForm1.Addtimeitem1Click(Sender: TObject);
var
  aTimeItem:TphDataEntity_Ganttime;
begin
  if Assigned(phGant1.Grid.FocusedCell) then
  begin
    aTimeItem:=phGant1.GridNode_AddGantTime(phGant1.Grid.AxisContentItemToGridTreeNode(phGant1.Grid.FocusedCell.AxisContentItemY),0);
    aTimeItem.Start:=phGant1.DateScaler.Start+5;
    aTimeItem.Stop:=phGant1.DateScaler.Start+15;
    aTimeItem.Color:=Random(65000);
    aTimeItem.Style:=gtsPipe;

    aTimeItem.Row.CollisionDetection:=CBCollisionDetectOnRows.Checked;
    aTimeItem.Row.IncreaseRowHeightOnCollision_SuggestedHeightPerItem:=20;
    aTimeItem.Row.IncreaseRowHeightOnCollision:=CBIncreaseRowHeightOnCollisions.Checked;

  end;
end;