Ver Mensaje Individual
  #3  
Antiguo 20-04-2010
Rowerto Rowerto is offline
Miembro
 
Registrado: abr 2010
Posts: 20
Reputación: 0
Rowerto Va por buen camino
Ya se que llego con unos cuantos años de retraso pero creo que he logrado que la busqueda hacia arriba funcione.

Código Delphi [-]
var foundat, anterior : longint;
    startpos, toend : integer;
begin
    startpos:=0;
    foundat:=0;
    if richedit1.Sellength<>0 then
    begin
      toend := richedit1.SelStart + richedit1.SelLength;
    end
    else
    begin
      toend := length(richedit1.text);
    end;

    while startpos < toend do
    begin
      anterior := foundat;
      foundat := richedit1.findtext(finddialog1.findtext, startpos, toend, [stmatchcase]);
      if (anterior <>-1) then
      begin
        richedit1.SetFocus;
        richedit1.SelStart:=foundat;
        richedit1.SelLength:=length(finddialog1.FindText);
        startpos := richedit1.SelStart + richedit1.SelLength;
      end;
    end;

    if anterior = 0 then
    begin
    MessageDlg('No encuentro '+finddialog1.FindText+' Tal vez hayas llegado al principio.', mtInformation, [mbOk], 0, );
    end
    else
    begin
      richedit1.SetFocus;
      richedit1.SelStart:=anterior;
      richedit1.SelLength:=length(finddialog1.FindText);
      richedit1.Perform(EM_SCROLLCARET, 0, 0);
    end;
   end;

El unico problema es que a la hora de buscar como no le ponga la palabra exacta no me lo encuentra (se que es por el stmatchcase de la busqueda). Alguien me puede decir como puedo hacer?
Responder Con Cita