Autor Beitrag
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 11.07.04 20:48 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
[...]

var MyTreeNode1: TTreeNode;

[...]

procedure TForm1.Button1Click(Sender: TObject);
begin
  with TreeView1.Items do
  begin
    MyTreeNode1 := Add(nil, Edit1.Text); { Stammknoten hinzufügen }
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  with TreeView1.Items do
  begin
    AddChild(MyTreeNode1, Edit1.Text);  { Untergeordneten Knoten hinzufügen }
  end;
end;


Also wenn man auf Button1 klickt wird ein Stammknoten erzeugt und wenn man auf Button2 klickt wird ein Untergeordneten Knoten erzeugt. Das funktioniert auch aber ein Untergeordnete Knoten wird immer nur in den zuletzt erstellten Stammknoten erzeugt. Wie kann ich machen das der Untergeordneten Knoten in den angeklickten Stammknoten erzeugt wird?
Schattengeist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 29



BeitragVerfasst: So 11.07.04 21:15 
Logisch. Du speicherst das in eine globale Variabele - und so wird die bei jeden neu anlegen überbügelt.
Der TreeView hat eine ActiveNove (oder ähnlich) Eigenschaft. Nimm die.

BTW: Globale Variablen sind 'böse'!

Edit: Gerade gefunden: TreeView.Selected
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Do 15.07.04 18:41 
Cool, danke hat mir echt weitergeholfen. :beer:
Arbeite gerade an meiner ersten Auftragsarbeit mit Bezahlung. :mrgreen: (Darf man das eigentlich mit 13 schon?)
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 15.07.04 19:31 
sorry, aber ich kann und will mir das jetzt hier nicht verkneifen:
wie kommt man als 13-jähriger an eine Enterprise-Version?

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Do 15.07.04 19:45 
Hm, ich hab da halt so meine Quellen. :angel:
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 15.07.04 19:47 
das ist mehr als zweideutig :roll:

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)