10343 : Questions on Grid color and iterations

Question

I have 3 questions. I am using the phGant control in VB.

1. I want to color the background several rows in the grid, I ‘m using 4 columns in treegrid, how can I do this?

2. How can I edit the text in a time item?

3. How can I iterate through the timetems in the RootDataEntitiesTree and change the start from the timeitems, timeitems on the second level are unchanged

Thank you very much in advance.

Answer

To set seperate background colors in the grid you need to assign GridLayoutproperties to the cells. To declare GridLayoutProperties you go like this:

  phGantX1.GridLayoutPropAdd
  phGantX1.GridLayoutPropAdd
  phGantX1.GridLayoutPropAdd
 
  phGantX1.GridLayoutPropSet 0, ColorConstants.vbYellow, ColorConstants.vbBlack, “Helvetica”, 8, 20, 20, False, True, False, True, False
  phGantX1.GridLayoutPropSet 1, ColorConstants.vbRed, ColorConstants.vbBlack, “Helvetica”, 8, 20, 20, False, True, False, True, False
  phGantX1.GridLayoutPropSet 2, ColorConstants.vbBlue, ColorConstants.vbWhite, “Helvetica”, 8, 20, 20, False, True, False, True, False

And to use them on a specific cell you go can use the IphGantX3.SetGridCellLayoutPropIndex method.

2. There is currently no support to edit time item texts. If you need to you can bring up a dialog with an edit box. your would then use IphDataEntity_GantTime2.TimeItemsTextSet to update the text with the new value.

3. To iterate thru time items you go like this:

  // Another quicker way to get hold of all the time items

 

for(int i=0;i<axphGantX1.DataList3levGantTimes().Count();i++)

  {
    phGantXControl.IphDataList2lev aList2Lev=axphGantX1.DataList3levGantTimes().get_DataList2Lev(i);
   

for(int ii=0;ii<aList2Lev.Count();ii++)

    {
      phGantXControl.IphDataList aList=aList2Lev.get_DataList(ii);
     

for(int iii=0;iii<aList.Count();iii++)

      {
        phGantXControl.IphDataEntity_GantTime2 aGantTime=aList.get_Items(iii)

as phGantXControl.IphDataEntity_GantTime2;

        aGantTime.Start=aGantTime.Start.AddDays(1);
        aGantTime.Stop=aGantTime.Stop.AddDays(1);
      }
    }
  }

Leave a Reply