AdvStringGrid: AutoSizeColumns() and node column

I have a number of AdvStringGrids with some having nodes and no text on the first column. AutoSizeColumns(true) nicely formats the grid for all but the nodes columns: just the header caption is taken into account, the with of the tree structure is not. ColWidth[] does not show an effect. Am I missing something, how can I properly set this for any node tree width?


Thanks in advance!
Matthias

We've investigated this and seen a shortcoming in this area. We've applied an improvement now and the next update will handle this better.

Great! Thanks so much, looking forward to the next version :-)

Almost working - I have updated and rebuilt my application, the grid column is now fully taking care of the node tree width and sizes that nicely. However: Now the header text of the column is not considered :-)


Row[0] contains 'Nodes' as header, nesting level is up to 3. Now the header is broken into 'Nod' on the first line of the cell, 'es' on the second. If I have 5 levels, the column is wide enough to show 'Nodes' on the single line.

Looks like something like a "max(ColTextWidth, NodeTreeWidth)" is missing somewhere to get required width.

One final thing: on my last grid row I am on 3rd node level, but below that horizontal node line there is suddenly an additional line going down to the grid border in a nearly 45° angle. Can send a screenshot via mail if preferred.

I have seen the 1st issue and applied an improvement. Next update will address this. For an urgent fix, contact us by email.

I was unable to reproduce the last issue, with the 45° angle though. Do you have exact instructions for reproducing this?
Small sample: create a form with an AdvStringGrid, code as follows:

procedure TMainForm.FormCreate(Sender: TObject);
begin

  AdvStrGrid.RowCount := 11;   // 11: odd looking, 12: looks okay
  AdvStrGrid.ColCount := 2;

  //  use nonsense span, should be rejected?
  AdvStrGrid.AddNode (1, -1);
  AdvStrGrid.AddNode (2, 0);
  AdvStrGrid.AddNode (3, 1);  // connects to next node block?!?

  //  proper node display.
  AdvStrGrid.AddNode (4, 3);  // connects to node block starting at idx 7 ?!?
  AdvStrGrid.AddNode (5, 2);  //   just because no "node-free" line on 7...

  //  proper node display.
  AdvStrGrid.AddNode (7, 4);
  AdvStrGrid.AddNode (8, 3);
  AdvStrGrid.AddNode (9, 2);

  //  forcing column width based on header text...
  //AdvStrGrid.AllCells[0, 0] := 'SLIGHTLY WIDER COLUMN';
  //  forcing column width based on node text...
  AdvStrGrid.AllCells[0, AdvStrGrid.RowCount-1] := 'SLIGHTLY WIDER COLUMN';

end;

Things I think are a bit odd:
  • When calling AddNode() with a span of less than 2, this should not create a node - looks odd or links through incorrectly
  • When creating two blocks of nodes that do not have a non-node row between them, the blocks are connected (comment the node creation for (7,3) for the clean one)
  • When a node block width level higher than 2 ends on the last grid row, strange node lines are introduced. Change RowCount at start for the effect

Thanks for the details. We could see the issues and have applied improvements. An update will follow shortly.