Autor Beitrag
Albanac
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37



BeitragVerfasst: Sa 28.09.02 15:41 
Ich Benutze folgende Prozedur um Formatierte Strings einer RichEdit Komponente hinzuzufügen.
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure prc_addstyled(tta_style: integer; str_text : string);
var
int_tlength : integer;
begin
int_tlength := Length(str_text);
frm_stat.re_stat.Lines.Add(str_text);
frm_stat.re_stat.SelStart := Length(frm_stat.re_stat.Text) - int_tlength;
frm_stat.re_stat.SelLength := int_tlength;
case tta_style of
0: ;
1: frm_stat.re_stat.SelAttributes.Color := clRed;
2: frm_stat.re_stat.SelAttributes.Color := clBlue;
end;
end;

Problem:
1. aufruf(prc_addstyled(1; 'nummereins');) ergibt
nu[mmereins[/color]
2. aufruf(prc_addstyled(1; 'nummereins');) ergibt
nummereins
3. aufruf(prc_addstyled(2; 'nummereins');) ergibt
nummereins
4. aufruf(prc_addstyled(2; 'nummereins');) ergibt
nummereins
5. aufruf(prc_addstyled(1; 'nummereins');) ergibt
nummereins

usw...
was mache ich falsch?
O'rallY
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Sa 28.09.02 19:54 
Auf die schnelle würde ich sagen, dass du den Zeilenumbruch nicht beachtest. Dieser sieht so aus : #13#10. Ein Zeilenumbruch ist also zwei Zeichen lang. Probiers mal so:
ausblenden Quelltext
1:
2:
3:
...
frm_stat.re_stat.SelStart := Length(frm_stat.re_stat.Text) - int_tlength - 2;
...

Habs nicht getested. Hoffe es funktioniert!

_________________
.oO'rallY
Linux is like a tipi: No gates, no windows and a gnu-eating apache inside...