Autor Beitrag
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Do 06.04.06 19:29 
Hi
Hab hier im Forum mal einen Code gefunden mit dem man die leere letzte Zeile aus einem RichEdit (JvRichEdit) löschen kann.
Kann ihn aber nicht mehr finden. :(
Hat ihn jemand?
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 06.04.06 20:23 
Hallo,

meinst Du eventuell den Thread?
Zeichen für "Ende der Textdatei"

oder hilft Dir der Code?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  RichEdit1.Selstart := Length(RichEdit1.Text)-2;
  RichEdit1.SelLength := 2;
  if RichEdit1.Seltext = #13#10 then
    RichEdit1.ClearSelection;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Do 06.04.06 20:51 
Ohne die If Anweisung hats bei mir geklappt.
Danke! :D
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Mo 10.04.06 20:43 
Hab doch noch das Problem.
Der Code löscht die letzten beiden Buchstaben.
Das soll eigentlich nicht sein.
Hab hier im Forum ja schonmal so einen Code gefunden aber den find ich einfach nicht mehr. :(
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 10.04.06 21:11 
Schau mal nach Trim.
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Mo 10.04.06 21:48 
Danke! :)
Aber leider geht bei Trim die Formatierung verloren.
Gibts noch eine andere Möglichkeit?
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 10.04.06 22:24 
Hallo,
user profile iconCoder hat folgendes geschrieben:
Ohne die If Anweisung hats bei mir geklappt.
Danke! :D

user profile iconCoder hat folgendes geschrieben:
Hab doch noch das Problem.
Der Code löscht die letzten beiden Buchstaben.
Das soll eigentlich nicht sein.
:gruebel: für den Fall war das if eingebaut,
aber kann auch mit dem JvRichEdit zusammenhängen. Eventuell bestehen dort die Zeilenumbrüche nicht aus #13#10 ?
Versuchs mal damit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
var z : Integer;
    c : Char;
begin
  for z := Length(RichEdit.Text) downto 1 do
    begin
    c := RichEdit.Text[z];
    if (c <> #10) and (c <> #13) then
      begin
      RichEdit.SelStart := z;
      RichEdit.SelLength  := Length(RichEdit.Text)-z;
      RichEdit.ClearSelection;
      Break;
      end;
    end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )