child nodes not displaying

I am building TMS FNCTreeview through code in a VCL application. The version # is 4.1.0.2.

The root node shows, but child nodes don't. I get the same behavior when I run the demo. Am I missing a setting? Here is a sample I downloaded from the TMS documentation for this control:

procedure TForm1.BuildTreeView;
var
 I: Integer;
 C: Integer;
 K: Integer;
 pn: TTMSFNCTreeViewNode;
begin
  Tree.BeginUpdate;
  Tree.ClearColumns;
  Tree.ClearNodes;
  Tree.Columns.Add.Text := 'Column 1';
  Tree.Columns.Add.Text := 'Column 2';
  for I := 0 to 2 do
  begin
    pn := Tree.AddNode;
    for C := 0 to Tree.Columns.Count - 1 do
      pn.Text[C] := 'Node ' + inttostr(I) + ' for ' +
      Tree.Columns[C].Text;
    if I = 0 then
    begin
      for K := 0 to 4 do
      begin
        var childn := Tree.AddNode(pn);
        for C := 0 to Tree.Columns.Count - 1 do
          childn.Text[C] := 'Child Node ' + inttostr(K);
      end;
    end;
  end;
  Tree.EndUpdate;
end;
procedure TForm1.BuildTreeView;
var
 I: Integer;
 C: Integer;
 K: Integer;
 pn, childn: TTMSFNCTreeViewNode;
begin
  Tree.BeginUpdate;
  Tree.ClearColumns;
  Tree.ClearNodes;
  Tree.Columns.Add.Text := 'Column 1';
  Tree.Columns.Add.Text := 'Column 2';
  for I := 0 to 2 do
  begin
    pn := Tree.AddNode;
    for C := 0 to Tree.Columns.Count - 1 do
      pn.Text[C] := 'Node ' + inttostr(I) + ' for ' + Tree.Columns[C].Text;
    if I = 0 then
    begin
      for K := 0 to 4 do
      begin
        childn := Tree.AddNode(pn);
        for C := 0 to Tree.Columns.Count - 1 do
          childn.Text[C] := 'Child Node ' + inttostr(K);
      end;
    end;
  end;
  Tree.ExpandAll;  // <---
  Tree.EndUpdate;
end;                  

Pawel,

This works to show the entire tree, but there is no way to expand or collapse a node (e.g., no "+" on the root note). How do I get this to show? Is there a property I can set in the object inspector so I don't need "Tree.ExpandAll"?

Terry

In other words, the ExpandNodeIcon does not appear.

Hi,

image

We get this when executing the code on a new instance of TTMSFNCTreeView, can you quickly put together a sample? Did you install other third party libraries or tools that might affect image drawing?

There are no third party components in this project. I created a new project, dropped a TMSFNCTreeview component on the form, and used the sample code I sent you. I did this to rule out another library interfering. The node icons don't appear.

I did however find a work around for right now. First, I exported the images in the NodesAppearance.ExpandNodeIcon and Nodes Appearance.CollaspedNodeIcon properties. Then, I dropped a TTMSFNCBitmapContainer on the form and imported the two images. Last I placed the following in the Form's OnCreate event, and the node icon displayed properly:

  Tree.NodesAppearance.ExpandNodeIcon   := TMSFNCBitmapContainer1.Items[0].Bitmap;
  Tree.NodesAppearance.CollapseNodeIcon := TMSFNCBitmapContainer1.Items[1].Bitmap;

Pawel,

I seem to be having this problem with Delph 11.2 only. I ran the sample code with Delphi 10.3.3 and the NodeIcons displayed perfectly.

It's nice that it was solved. I only tested in Lazarus.

Have a nice day.

Thanks for your help. Have a great day!

Strange, I tested this in 11.2 without issues...