Ver Mensaje Individual
  #7  
Antiguo 25-04-2008
santus santus is offline
Miembro
 
Registrado: ene 2006
Posts: 130
Reputación: 19
santus Va por buen camino
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) ;    // Se situa en la linea de reDocumento.
          //Perform(EM_SCROLLCARET, 0, 0);             // Mueve el scroll.
          SetFocus;
          SelLength := Length(Lines.Strings[i]);
          atributosGenerales  := DefAttributes;
          procesarLinea(i,Lines.Strings[i]);  //reDocumento.Lines.String[i] es toda la linea seleccionada.
    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 ; //se posiciona sobre la palabra en la línea.
        reDocumento.SelLength := Length(textoParcial);
        // Aquí tienes que buscar la palabra en la lista:
        // supongamos BuscarEnLista(textoParcial) ... textoParcial Contiene el texto seleccionado.
        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.
__________________
"El ordenador nació para resolver problemas que antes no existían." Bill Gates.
Responder Con Cita