Hi
 
I'm having trouble with TTreeView - no doubt due to ignorance. Does anyone have simple example(s) of builing and using a treeview?
 
Here's the sort of ignorance I confess to:
 
I have tv: TTreeview on a form, and code that adds some nodes:
 
       newnode := tv.items.addchild(nil, 'A');
       newnode := tv.items.addchild(nil, 'B');
       newnode := tv.items.addchild(newnode, 'B1');
       newnode := tv.items.addchild(newnode, 'B12');
       newnode := tv.items.addchild(newnode, 'B123');      
 
and that builds a tree OK, schematically like this
 
...A
...B
......B1
.........B12
............B123 
 
If the treeview option tvoAutoExpand is True, I get the whole tree and can click about the tree and select nodes. But if tvoAutoExpand is False, the tree is (correctly) drawn collapsed, and  clicking to expand (eg node B), or on a node with no children (eg Node A) both result in a SigSegV in include/treeview.inc at line 1590 which is the indicated line here:
 
function TTreeNode.GetLevel: Integer;
// root is on level 0
var
  ANode: TTreeNode;
begin
  Result := 0;
  ANode := Parent;         <<<<<<<<<<<line 1590
  while Assigned(ANode) do
  begin
    Inc(Result);
    ANode := ANode.Parent;
  end;
end;  
 
 
Obvioiusly I'm missing a lot but I cannot find any example to dispel the fog. Anyone got one?
 
Joe
-------------------------
joe.sheph...@cyberservices.com
Perth, WA, Australia.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to