Hi, Boki:
Yes, the test NG5 to NG6 conversion now properly collapses the tree. Thank you.
But, there is still the issue of no vertical scroll bar, even though property is set.
And the tree structure is off (meaning some nodes are now children when they should be siblings) and there are blank tree nodes.
Below is my code that I revised somewhat for the conversion. This routine fills the test NG6 grid:
PROCEDURE LoadGridTable6(Grid: TNextGrid6);
VAR
RowParent, RowParentRow, i, j: INTEGER;
ParentStrID: STRING;
TableID: INTEGER;
BEGIN
if Grid.Name = 'gridScanScope6' then
TableID := 1;
WITH ModData.qryAnyUse4 DO
BEGIN
SQL.Clear;
SQL.Add('SELECT WIZ_TR_ID, w.ML_ID, Parent_ID, Wiz_Table_ID, Order_Index, ');
SQL.Add(GetSQLDecrip('ml_item'));
SQL.Add('from Wiz_Table_Rows w JOIN MasterLibrary ml ON ml.ML_ID = w.ml_id ');
SQL.Add('where Wiz_Table_ID = :ID');
SQL.Add('Order by Order_Index');
Prepare;
ParamByName('ID').AsInteger := TableID;
Open;
First;
i := 0;
j := 0;
Grid.ClearRows;
WHILE NOT eof DO
BEGIN
WITH Grid DO
BEGIN
IF FieldByName('Parent_ID').AsInteger = -1 THEN
BEGIN
AddRow(1);
// if any children note the parent
RowParent := FieldByName('ML_ID').AsInteger;
RowParentRow := i;
ParentStrID := 'NO PARENT ID';
END
ELSE IF FieldByName('Parent_ID').AsInteger > -1 THEN
BEGIN
ParentStrID := 'ML' + IntToStrZeroPad(FieldByName('Parent_ID')
.AsInteger, 10);
RowParentRow := GetParentRow6(ParentStrID, Grid);
// AddChildRow(RowParentRow, crLast);
AddChildRow(RowParentRow)
END;
// fill in all column information
Cell[0, LastAddedRow].asString := FieldByName('ml_item').asString;
// hidden row with info: RowID, either from ML or as User added row + ParentID + Original ID/
Cell[Columns.Count - 1, LastAddedRow].asString :=
'ML' + IntToStrZeroPad(FieldByName('Wiz_TR_ID').AsInteger, 10) + '|' +
ParentStrID + '|NO CLONE ID_';
// adjust row height based on added description
// looks like you need this one that adds fudge factor to height, otherwise
// some cells are too short
GetBestFitRow6(LastAddedRow, 0, Grid);
END; // with grid
Next;
Inc(i);
END; // while not eof
ModData.qryAnyUse4.Close;
IF RecordCount > 0 THEN
// when done colapse all child nodes
// Starting with top row, top level
begin
// this doesn't work to collapse, nor does CollapsAllChildren
for j := 0 to Grid.RowCount do
begin
if Grid.RowExists(j) then
Grid.Row[j].Collapse(True);
end;
//7/23/18 per Boki Row[x].Selected is more for multi-select, in any case
//it does not actually make the row selected visually
// Grid.Row[0].Selected := True;
Grid.SelectedRow := 0;
Grid.ScrollToSelected;
// CollapseAllChildren6(0, 1, Grid)
end;
END; // with qryAnyUse3
END;