enecumene: Yo lo hice una vez para procesar archivos RTF: Te lo dejo asi te das una idea. Despues lo adaptas a tu proyecto :
Código Delphi
[-]
procedure Tform1.ReccorrerTexto;
var
i : Integer;
begin
for i := 0 to reDocumento.Lines.Count -1 do begin
with reDocumento do begin
SelStart := Perform(EM_LINEINDEX, i, 0) ; SetFocus;
SelLength := Length(Lines.Strings[i]);
atributosGenerales := DefAttributes;
procesarLinea(i,Lines.Strings[i]); end;
end;
end;
procedure procesarLinea(Position:Integer; Text: String);
var
textoParcial : string;
posInicial : integer;
begin
if (Trim(Text) <> '') then begin
posInicial := 0;
for i := 1 to Length(Text) + 1 do begin
if (Text[i] = ' ') or (i = Length(Text) + 1 ) then begin
reDocumento.SelStart := reDocumento.Perform(EM_LINEINDEX, Position, 0)+posInicial ; reDocumento.SelLength := Length(textoParcial);
posInicial := i;
textoParcial := '';
end else if not ( Text[i] = #0) then textoParcial := textoParcial + Text[i];
end;
end;
end;
Fijate que por ahí me comí algo en el código porque le saqué un monton de cosas mas que había en el medio que no viene a este caso. Intenta probarlo y después nos cuentas como te fue
...
reinier: No creo que esto te sirva... me imagino que tendrías que elaborar algo con el keypress.... igual no se me ocurre qué. Esto no te servira porque te mueve el cursor en donde estas escribiendo. Si te sirve si lo quieres procesar todo de una.
Saludos a todos.