Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Situar el Cursor y mover el Scroll de un TRichEdit (https://www.clubdelphi.com/foros/showthread.php?t=80749)

dec 14-07-2006 15:45:01

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;


La franja horaria es GMT +2. Ahora son las 01:24:40.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi