Registriert seit: 27. Mai 2004
Ort: Bad Sooden-Allendorf
240 Beiträge
Delphi 6 Professional
|
Re: Fehler beim allowup
12. Jun 2007, 11:52
Mit Kanone auf Spatz geschossen - aber getroffen:
Delphi-Quellcode:
function findtextall(re: TRichEdit; sText: string; options:TSearchTypes): TIntegerdynarray;
var
istart, ifound, ilength: integer;
begin
setlength(result, 0);
istart := 0;
ilength := length(re.Lines.Text);
while istart < (ilength - length(stext)) do
begin
ifound := re.FindText(sText, istart, ilength - istart, options);
if ifound = - 1 then
exit;
Setlength(Result, succ(length(result)));
result[high(result)] := ifound;
istart := ifound + length(stext);
end;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
x: integer;
s: string;
ida: TIntegerDynArray;
begin
If SpeedButton1.Down = true then
RichEdit1.SelText := '[b]' + RichEdit1.SelText + '[/b]';
If Speedbutton1.Down = false then
begin
RichEdit1.SelText := StringReplace(RichEdit1.SelText,'[b]', '', [RfReplaceAll]);
s := '[/b]';
ida := findtextall(RichEdit1, s, []);
for x := low(ida) to high(ida) do
with RichEdit1 do
begin
selstart := ida[x];
sellength := length(s);
seltext := '';
end;
RichEdit1.SetFocus;
end;
end;
|
|
Zitat
|