I am building a report in the AdvStringGrid, I run a query on an events table to generate the top level nodes, these provide tick ranges for the alloc table and free table queries.
The alloc and free query results are used to add child nodes to the top level event nodes. When I call InsertChildRow(), I need to know the row id of the newly added node.
Example:
dmApp.ReportQuery.Execute;
if dmApp.ReportQuery.IsQuery then
begin
dmApp.ReportQuery.First;
repeat
//Add row
FGrid.InsertChildRow(AbsoluteIndex);
//FGrid.AddNode(AbsoluteIndex, 1);
s := FGrid.Row; //This does not get the new row's id
FGrid.Cells[ALLOC_EVENT_R//EPORT_COL_EVENT, s] := 'Alloc';
FGrid.Cells[ALLOC_EVENT_REPORT_COL_ADDRESS, s] := dmApp.ReportQuery.FieldByName('Address').AsString;
FGrid.Ints[ALLOC_EVENT_REPORT_COL_TICKSCNT, s] := dmApp.ReportQuery.FieldByName('TicksCnt').AsInteger;
FGrid.Ints[ALLOC_EVENT_REPORT_COL_TASK_NUM, s] := dmApp.ReportQuery.FieldByName('Tasknum').AsInteger;
if dmApp.ReportQuery.IsQuery then
begin
dmApp.ReportQuery.First;
repeat
//Add row
FGrid.InsertChildRow(AbsoluteIndex);
//FGrid.AddNode(AbsoluteIndex, 1);
s := FGrid.Row; //This does not get the new row's id
FGrid.Cells[ALLOC_EVENT_R//EPORT_COL_EVENT, s] := 'Alloc';
FGrid.Cells[ALLOC_EVENT_REPORT_COL_ADDRESS, s] := dmApp.ReportQuery.FieldByName('Address').AsString;
FGrid.Ints[ALLOC_EVENT_REPORT_COL_TICKSCNT, s] := dmApp.ReportQuery.FieldByName('TicksCnt').AsInteger;
FGrid.Ints[ALLOC_EVENT_REPORT_COL_TASK_NUM, s] := dmApp.ReportQuery.FieldByName('Tasknum').AsInteger;