Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
336 Beiträge
 
#2

AW: TRichEdit - veim Verlassen auf den Anfang des Dokuments springen

  Alt 3. Okt 2024, 18:45
Hi,

This works for me,
Delphi-Quellcode:
const
  EM_GETSCROLLPOS = $04DD;
  EM_SETSCROLLPOS = $04DE;

procedure RichEditScrollToPoint(ARichEdit: TRichEdit; X, Y: Integer);
var
  Pos: TPoint;
begin
  Pos.X := X;
  Pos.Y := Y;
  //PostMessage(RichEdit1.Handle,EM_SETSCROLLPOS,wParam(0),lParam(@FPos)); // ONLY use PostMessage if Pos is on the heap (not local var) !!
  // or
  SendMessage(ARichEdit.Handle, EM_SETSCROLLPOS, wParam(0), lParam(@Pos));
end;

procedure TForm10.RichEdit1Exit(Sender: TObject);
begin
  RichEditScrollToPoint(RichEdit1, 0, 0);
end;
Kas
  Mit Zitat antworten Zitat