Ver Mensaje Individual
  #1  
Antiguo 14-07-2006
Avatar de dec
dec dec is offline
Moderador
 
Registrado: dic 2004
Ubicación: Alcobendas, Madrid, España
Posts: 13.107
Reputación: 34
dec Tiene un aura espectaculardec Tiene un aura espectacular
Situar el Cursor y mover el Scroll de un TRichEdit

Una solución puede ser:

Código Delphi [-]
RichEdit1.Perform(EM_SCROLLCARET, 0, 0);

Y en contexto podría quedar más o menos de este modo:

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
const
  S = 'cadena-busqueda';

var
  posResultado: integer;

begin

  with RichEdit1 do
    posResultado := FindText(S, 0, Length(Text), []);

  if (posResultado <> -1) then
  begin
    with RichEdit1 do
    begin
      SetFocus;
      SelStart := posResultado;
      SelLength := Length(S);
      Perform(EM_SCROLLCARET, 0, 0);
    end;
  end;

end;
Responder Con Cita