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());

.

Leave a Reply