10320 : How can I iterate over my rows’ entities? VCL D7


I am trying your component TphGant. I am using Delphi7, and using native component. I did an example. I have gant and a table with two fields. Name and duration. i am able to put these names to the gant and display duration of these names. The user can change duration with the mouse and I need to change duration in my table. but I am not able to iterate from the first TphDataEntity_Ganttime to the last in a row.

How can I iterate over my rows’ entities?


Each GantRow has a datalist that holds the drawing layers. Each drawing layer has a list that holds the time items. You can iterate them like this:

procedure TForm1.Button2Click(Sender: TObject);
  for i:=0 to phGant1.RowList.Count-1 do
    for ii:=0 to phGant1.RowList.Rows[i].DataLists.Items[0].Count-1 do
      (phGant1.RowList.Rows[i].DataLists.Items[0].Items[ii] as TphDataEntity_GantTime).Start:=

The same code for ActiveX in VB:

    Dim ti As IphDataEntity_GantTime2
    For i = 0 To phGantX1.RowList.Count – 1  ‘ loop over all gantt rows
        For ii = 0 To phGantX1.RowList.GantRow(i).DataLists.Count – 1 ‘ loop over all layers in gantt row
            For iii = 0 To phGantX1.RowList.GantRow(i).DataLists.DataList(ii).Count – 1 ‘loop over all time items          
                Set ti = phGantX1.RowList.GantRow(i).DataLists.DataList(ii).Items(iii)                
                ti.Start = ti.Start + 1
                ti.Stop = ti.Stop + 1
            Next iii
        Next ii
    Next i

Leave a Reply