Autor Beitrag
oroblram
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Win XP
Delphi 7
BeitragVerfasst: Mi 17.05.06 10:40 
Hallo zusammen
Wie kann ich die Anzahl der Zeilen in einem Memo auf 10 beschränken?

Habs folgendermaßen versucht:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
for i:=0 to Memo1.Lines.Count-1 do
begin
    if Memo1.Lines.Count > 10 then
    begin
        memo1.Lines.Delete(10);
    end;
end;


Das Problem dabei ist, dass, wie im Code ersichtlich, eben immer die letzte Zeile gelöscht wird,
d.h. wenn ich mittendrin im Memo, z.B. in Zeile 5, einen Zeilenumbruch erwirke, wird die letzte Zeile gelöscht.
Was ich aber tatsächlich will: Ein Zeilenumbruch soll verhindert werden, sobald 10 Zeilen vorhanden sind. Sind dann wieder weniger Zeilen vorhanden, soll der Zeilenumbruch natürlich wieder möglich sein.

Danke für eure Hilfe!
azubi_20
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 593

WinXP SP2, Ubuntu 8.4
D7 Enterp., D2005 Prof., Java (Eclipse 3.4.0)
BeitragVerfasst: Mi 17.05.06 10:49 
oroblram Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21

Win XP
Delphi 7
BeitragVerfasst: Mi 17.05.06 11:21 
Danke für den Hinweis! Klappt wunderbar!