Autor Beitrag
Muetzi
Gast
Erhaltene Danke: 1



BeitragVerfasst: So 23.11.03 18:27 
So, ich hoffe das ist jetzt mein letztes Problem...

Ich habe ne Treeview in etwa so:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
Thema 1
             Unterpunkt1
             Unterpunkt2
Thema2
             Unterpunkt1
             Unterpunkt2


Jetzt brauche ich ne Schleife die den Unterpunkten ein Stateindex zuweist so:
Punk1 = 1
Punk2 = 2

Punk1 = 1
Punkt = 2

Also in jedem Thema von neuem Zählt.

Habs schon versucht, bekomms aber nicht hin!



Gruß

Muetzi
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
case zahl of
1 : begin form1.tv1.Items.AddChild(form1.tv1.Items[0],str1);
    form1.tv1.Items[ia[8]].Item[ia[1]].StateIndex := ia[1] + 1;
    ia[1]:= ia[1] + 1;
    inc(ia[8]);
    end;
 2 : begin form1.tv1.Items.AddChild(form1.tv1.Items[0],str1);
 form1.tv1.Items[ia[8]].Item[ia[2]].StateIndex := ia[2] + 1;
    ia[2]:= ia[2] + 1;
    inc(ia[8]);
    end;
3 : begin form1.tv1.Items.AddChild(form1.tv1.Items[0],str1);
form1.tv1.Items[ia[8]].Item[ia[3]].StateIndex := ia[3] + 1;
    ia[3]:= ia[3] + 1;
    inc(ia[8]);
    end;
4 : begin form1.tv1.Items.AddChild(form1.tv1.Items[0],str1);
form1.tv1.Items[ia[8]].Item[ia[4]].StateIndex := ia[4] + 1;
    ia[4]:= ia[4] + 1;
    inc(ia[8]);
    end;
5 : begin form1.tv1.Items.AddChild(form1.tv1.Items[0],str1);
form1.tv1.Items[ia[8]].Item[ia[5]].StateIndex := ia[5] + 1;
    ia[5]:= ia[5] + 1;
    inc(ia[8]);
     end;
6 : begin form1.tv1.Items.AddChild(form1.tv1.Items[0],str1);
form1.tv1.Items[ia[8]].Item[ia[6]].StateIndex := ia[6] + 1;
    ia[6]:= ia[6] + 1;
    inc(ia[8]);
     end;
 7 : begin form1.tv1.Items.AddChild(form1.tv1.Items[6],str1);
     form1.tv1.Items[ia[8]].Item[ia[7]].StateIndex := ia[7] + 1;
    ia[7]:= ia[7] + 1;
    inc(ia[8]);
     end;
end;
CenBells
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1547

Win 7
Delphi XE5 Pro
BeitragVerfasst: Mo 24.11.03 01:04 
hallo,

warum lässt du dir nicht den root node geben und dann zählst du für jeden sibling weiter. das heißt, für jeden bruder zählst du von neuen allle kinder durch.

Gruß

ken

Edit: war der 888. Beitrag :wink:

_________________
Eine Klasse beschreibt die Struktur und das Verhalten einer Menge gleichartiger Objekte.
Ist die Frage beantwortet? Das Problem gelöst?

Dann klicke hier, um das Thema entsprechend zu markieren!