Autor Beitrag
fablio
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

WIN XP
D7 Ent
BeitragVerfasst: Mi 04.06.03 14:07 
Hi

Ich habe eine ListView komponente und möchte dort Treenodes erstellen:
ausblenden Delphi-Quelltext
1:
2:
3:
var Node: TTreenode;
begin
  node := TTreenode.create(?);

Was kommt dort hinein? Gibt es irgendwo ein verzeichnis diese Aufgelistet sind (self, usw)?

mfg

_________________
Der Optimist hofft, alles werde beim alten bleiben; der Pessimist befürchtet dies.
W. Saroyan
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 04.06.03 14:15 
Hallo!

bei einer ListView kannst du nur tListItem(s) benutzen und keine tTreeNode(s).

Gruß
Tino
fablio Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

WIN XP
D7 Ent
BeitragVerfasst: Mi 04.06.03 15:13 
sorry ich meinte natürlich die Treeview-Komponente

_________________
Der Optimist hofft, alles werde beim alten bleiben; der Pessimist befürchtet dies.
W. Saroyan
Bayo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Mi 04.06.03 15:25 
am besten erstellst du einen neuen Tree node folgendermassen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var
  node: TTreeNode;
  tv: TTreeView;
begin
  tv := TTreeView.Create(Self);
  try
    node := tv.Items.Add(nil, 'Caption');
    node := tv.Items.AddChild(node, 'Caption');
  finally
    FreeAndNil(TTreeView);
  end;
end;


Es macht in den wenigsten Fällen sinn ein Objekt vom Typ TTreeNode manuel zu erstellen! Wenn du dass aber trotzdem machen möchtest:

node := TTreeNode.Create(tv.Items);

Grüsse Dominic