Autor Beitrag
Martello
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

WIN 2000
TP, C, Delphi 1.0, Turbo Delphi 2006, Delphi 7
BeitragVerfasst: Mo 30.03.09 14:02 
Hallo,

ich dachte, TStringList wäre ein gut geeigntes Objekt, um Mess-Daten aus einer Textdatei in einem Diagramm scrollbar darzustellen.

Bis dann die Fehlermeldung mit der "Indexüberschreitung (> 6835)" erschien :cry:
Sollte ich stattdessen besser ein Array verwenden? Anders als früher in TP sollen diese ja in Delphi dynamisch konfektionierbar sein. Welche Längenbegrenzungen bestehen denn für Arrays of Real?

Mo.

Moderiert von user profile iconNarses: überflüssige Zeilenumbrüche entfernt
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 30.03.09 14:03 
Moin!

Die Exception tritt nicht wegen Speichermangel auf, sondern weil du auf einen Index zugreifst, der nicht existiert! :idea: ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Martello Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

WIN 2000
TP, C, Delphi 1.0, Turbo Delphi 2006, Delphi 7
BeitragVerfasst: Mo 30.03.09 14:15 
user profile iconNarses hat folgendes geschrieben Zum zitierten Posting springen:
Die Exception tritt nicht wegen Speichermangel auf, sondern weil du auf einen Index zugreifst, der nicht existiert! :idea: ;)


Da bin ich ja einerseits beruhigt :?
Andererseits ist meine Textdatei aber 8075 Zeilen lang.. :(

Mo.

---Moderiert von user profile iconNarses: Beiträge zusammengefasst---

Sorry, ich muß mich korrigieren.
edit2.Text:=inttostr(mylist.capacity) liefert zwar 8075.
Aber es gibt tatsächlich nur 6835 Zeilen; ich habe nachgezählt :?

Schließt sich somit die nexte Frage an: Wer nennt mir dann die Zeilenzahl?

Mo.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 30.03.09 14:27 
Capacity: Kapazität der Liste. Hat eine interne Bedeutung ("wie viel passt noch rein, ohne dass man umkopieren muss"). Die Anzahl der Zeilen liefert MyList.Count, der letzte Index ist dann MyList.Count-1, da man bei 0 anfängt zu zählen.

_________________
We are, we were and will not be.


Zuletzt bearbeitet von Gausi am Mo 30.03.09 14:27, insgesamt 1-mal bearbeitet
Martello Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

WIN 2000
TP, C, Delphi 1.0, Turbo Delphi 2006, Delphi 7
BeitragVerfasst: Mo 30.03.09 14:27 
user profile iconMartello hat folgendes geschrieben Zum zitierten Posting springen:

Schließt sich somit die nexte Frage an: Wer nennt mir dann die Zeilenzahl?

Mo.


Ok. Ich habe es andernorts erfahren. Aber Kapazität klingt ja auch so ähnlich...
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Mo 30.03.09 14:27 
Die Indexe der Zeilen gehen von 0 bis Zeilenzahl-1

Edit: Hm, ich hatte da doch mal nen Bug bei der neue-Beiträge-Meldung im Editor gefunden -.-

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.


Zuletzt bearbeitet von jakobwenzel am Mo 30.03.09 14:29, insgesamt 1-mal bearbeitet
Nersgatt
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1581
Erhaltene Danke: 279


Delphi 10 Seattle Prof.
BeitragVerfasst: Mo 30.03.09 14:27 
Vielleicht myList.Count

_________________
Gruß, Jens
Zuerst ignorieren sie dich, dann lachen sie über dich, dann bekämpfen sie dich und dann gewinnst du. (Mahatma Gandhi)