Ver Mensaje Individual
  #1  
Antiguo 03-04-2006
Avatar de Durbed
Durbed Durbed is offline
Miembro
 
Registrado: ago 2004
Posts: 166
Reputación: 22
Durbed Va por buen camino
Buscar en un TRichEdit

Necesito buscar una cadena en un TDecRichEdit, que es un componente deribado de TRichEdit. Para buscar estoy usando el dialogo de Buscar TFindDialog, pero aunque muestra la opcion de hacer coincidir mayusculas y minisculas, esa funcion no funciona, con lo que se hace realmente dificil encontrar algo a no ser que este escrito correctamente. Ademas encuentra bien la primera palabra, pero para ver los resultados sucesivos, no pierde el foco la ventana de buscar y por lo tanto hay que ir picando en el TDecRichEdit, el codigo que le he puesto es este:
Código Delphi [-]
procedure TFVerEditar.FD1Find(Sender: TObject);
var
  FoundAt: LongInt;
  StartPos, ToEnd: Integer;
begin
  with MNotasDir do
    begin
      if SelLength <> 0 then
        StartPos := SelStart + SelLength
      else
        StartPos := 0;

      ToEnd := Length(MNotasDir.Text) - StartPos;

      FoundAt := FindText(FD1.FindText, StartPos, ToEnd, [stMatchCase]);
      if FoundAt <> -1 then
        begin
          MNotasDir.SelStart := FoundAt;
          MNotasDir.SelLength := Length(FD1.FindText);
          MNOtasDir.SetFocus;
        end
      Else
        ShowMessage('No encuentro ' + FD1.FindText);
    end;
end;
Esta sacado de la ayuda de delphi.

Un saludo y gracias.
__________________
Intentando hacer algo con Delphi 7 y Firebird 1.5
Responder Con Cita