Autor Beitrag
SHIFTER
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 65

Win 2k SRV, Win XP, Vista, SuSe Linux SRV
Delphi 11
BeitragVerfasst: Mo 19.05.03 00:41 
Hi leute,
Folgende problematik beschäftigt mich seit längeren zeit :

Nehmen wir an wir haben folgende struktur :
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
--Deutschland+--Wuppertal+--Schwebebahn--Bahnhof
                     |                |
                     |                +--Eisenbahn--+--Bahnhof
                     |                                      |
                     |                                      +--Brücke
                     |
                     +--Düsseldorf--+--Eisenbahn +--Bahnhof
                                                                |
                                                                +--Brücke
...

Wie kann ich eindeutig bestimmen wenn der User anklickt z.B. Deutschland\Wuppertal\Eisenbahn\Brücke Wie kann ich es eindeutig bestimmen was er angeklickt hat ? TreeView.Selected.Text liefert nur den lätzten begriff, ich brauche aber auch die Begriffe die vor ihm liegen.

Habt ihr eine idee ???

danke
seba

Moderiert von user profile iconTino: Code-Tags hinzugefügt.
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 19.05.03 00:54 
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 19.05.03 08:17 
Hallo,

versuch mal diesen Code hier:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
Function GetTreeNodePath (aNode: TTreeNode; aDiv: String): String;
Begin
  If Assigned (aNode) Then
    If aNode.Level <> 0 Then
      GetTreeNodePath := GetTreeNodePath (aNode.Parent, aDiv) + aDiv + aNode.Text
    Else
      GetTreeNodePath := aNode.Text
  Else
    GetTreeNodePath := '';
End;

procedure TForm1.TreeView1Change(Sender: TObject; Node: TTreeNode);
begin
  Label1.Caption := GetTreeNodePath (Node, '/');
end;

Sag bitte ob er funktioniert. Wenn ja, mach ich einen FAQ-Beitrag daraus.

Gruß
Tino
SHIFTER Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 65

Win 2k SRV, Win XP, Vista, SuSe Linux SRV
Delphi 11
BeitragVerfasst: Mo 19.05.03 10:47 
:D Ok leute ihr habt 1 länderpunkt bekomment,
ich habe mich mit der sch.... rumgeprügelt ohne ende.

Danke TINO und TOMS für die antworten
es waren alle beide 100% !!!

ES LEBE AUQ.DE !!!!


gruss
seba
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mo 19.05.03 11:02 
Hab einen FAQ Beitrag erstellt: ...den Node-Pfad (als String) in einer TreeView ermitteln?

Gruß
Tino