I am having real problems with getting a TreeNode to be expanded on startup of my exe. I have managed to make it never collapse after you have expanded it manually...
procedure TMainForm.TreeViewCollapsing(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean);
begin
AllowCollapse := false;
end; //This works!!
I have some of the attempts that I can remember:
var
N: TTreeNode;
N.Parent.Expand(True); // causes a fatal error
TreeView.FullExpand; // doesn't appear to have any effect
N := TTreeView(N.TreeView).Items.getFirstNode;// TTreeVeiw and TTreeNode incompatable apparently?!
N := N.getFirstChild;//fatal error
(I am putting them first In a procedure that happens on exe startup)
Does anyone know the correct way to do this?
ps: AutoExpand in the Object Inspector has no effect
procedure TMainForm.TreeViewCollapsing(Sender: TObject; Node: TTreeNode;
var AllowCollapse: Boolean);
begin
AllowCollapse := false;
end; //This works!!
I have some of the attempts that I can remember:
var
N: TTreeNode;
N.Parent.Expand(True); // causes a fatal error
TreeView.FullExpand; // doesn't appear to have any effect
N := TTreeView(N.TreeView).Items.getFirstNode;// TTreeVeiw and TTreeNode incompatable apparently?!
N := N.getFirstChild;//fatal error
(I am putting them first In a procedure that happens on exe startup)
Does anyone know the correct way to do this?
ps: AutoExpand in the Object Inspector has no effect