Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi treeview subitems stateindex zuweisen! (https://www.delphipraxis.net/12239-treeview-subitems-stateindex-zuweisen.html)

Muetzi 23. Nov 2003 17:28


treeview subitems stateindex zuweisen!
 
So, ich hoffe das ist jetzt mein letztes Problem...

Ich habe ne Treeview in etwa so:

Code:
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
Delphi-Quellcode:
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;


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:58 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz