Autor Beitrag
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 19.04.03 03:40 
Hi,

ich hab grad nen problem mit dem TTreeView... wenn ich beim Tree MultiSelect aktiviere und mehrere TreeNodes auswähle.. dann steht in TreeView.SelectionCount die anzahl der ausegwählten Nodes...

Wenn ich jetzt eine schleife mache:

ausblenden Quelltext
1:
2:
for i:=0 to TreeView.SelectionCount-1 do
  ShowMessage(TreeView.Selections[i].Text);


gibt es bei i>0 ne Fehlermeldung "List index out of bounds"... aber, wieso??? :roll:

Selbst in der Hilfe steht das der Maximale wert von Selections SelectionCount-1 ist... *guckt verwirrt*

Hat wer ne idee??

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: Sa 19.04.03 11:38 
Hallo Aya,

also ich finde bei meinem TTreeView weder eine Eigenschaft SelectionCount noch eine Eigenschaft MultiSelect :?: :?:

Welche Delphi Version?

Grüße
Florian :roll:
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 19.04.03 14:23 
Hi,

Delphi 6 Prof. hab ich :)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: Sa 19.04.03 14:33 
Hallo Aya,

habe gerade mal in Delphi 6 getestet.

Folgender Code funktioniert ohne Probleme:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
var
  i:integer;
begin
  for i := 0 to TreeView1.SelectionCount - 1 do begin
    showmessage(TreeView1.Items[i].Text);
  end;
end;


Grüße
Florian
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 19.04.03 14:46 
Hi,

deine Variante ist aber falsch... :)
Denn du lässt dir die Items von 0..SelectionCount-1 ausgeben.. nicht die ausgewählten... (du benutzt TreeView.Items nicht TreeView.Selections)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 19.04.03 14:48 
mh... aber stimmt, wenn ich es in nem neuen test Prog mit Selections mache geht es auch... ok, dann liegt der fehler irgendwo bei mir im Programm :)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: Sa 19.04.03 14:52 
Aya hat folgendes geschrieben:
deine Variante ist aber falsch... :)
Denn du lässt dir die Items von 0..SelectionCount-1 ausgeben.. nicht die ausgewählten... (du benutzt TreeView.Items nicht TreeView.Selections)


Das ist egal. SelectionCount gibt den ItemIndex für den Zugriff auf Items aus.

Grüße
Florian :roll:
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 19.04.03 14:55 
FloSch hat folgendes geschrieben:
Das ist egal. SelectionCount gibt den ItemIndex für den Zugriff auf Items aus.

Nee.... SelectionCount gibt die anzahl der ausgewählten einträge zurück.

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: Sa 19.04.03 15:00 
Aya hat folgendes geschrieben:
FloSch hat folgendes geschrieben:
Das ist egal. SelectionCount gibt den ItemIndex für den Zugriff auf Items aus.

Nee.... SelectionCount gibt die anzahl der ausgewählten einträge zurück.


Tatsache. Whoops ich nehm alles zurück und behaupte das Gegenteil! :lol:

Grüße
Florian :roll:
FloSch
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 129



BeitragVerfasst: Sa 19.04.03 15:01 
Dann nehme das hier:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
var
  i:integer;
begin
  for i := 0 to TreeView1.SelectionCount - 1 do begin
    showmessage(TreeView1.Selections[i].Text);
  end;


Geht wunderbar.

Grüße
Florian :roll:
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 19.04.03 15:23 
Ich weiß, ich sagte doch das der fehler irgendwo in meinem Programm liegen muß ;)

Aber danke.

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!