![]() |
"Gehe zu Zeile" in TRichEdit bzw. TSynEdit
Hallo,
ich wollte für mein Programm eine "Gehe zu Zeile" funktion machen.. aber irgendwie klappt mein Code nicht:
Delphi-Quellcode:
kann mir jemand weiterhelfen?
procedure TMainForm.GotoLine(Line: Integer);
var Pos: TPoint; HwnD: Integer; begin if (Documents.PageCount <= 0) or (Documents.ActivePage = nil) then Exit; Pos.X := 0; if not Dokumente[Documents.ActivePage.TabIndex+1].EditorMode then HwnD := (FindComponent('RichEdit'+IntToStr(Documents.ActivePage.TabIndex+1)) as TRichEdit).Handle else HwnD := (FindComponent('SynEdit'+IntToStr(Documents.ActivePage.TabIndex+1)) as TSynEdit).Handle; Pos.Y := Line; if not Dokumente[Documents.ActivePage.TabIndex+1].EditorMode then begin SendMessage(HwnD,EM_LINESCROLL,0,-1 * SendMessage(hWnD, EM_EXLINEFROMCHAR, 0, (FindComponent('RichEdit'+IntToStr(Documents.ActivePage.TabIndex+1)) as TRichEdit).SelStart) ); (FindComponent('RichEdit'+IntToStr(Documents.ActivePage.TabIndex+1)) as TRichEdit).SelStart := SendMessage(hwnd,EM_LINEINDEX,Pos.Y -1,0); end else begin SendMessage(hwnd,EM_LINESCROLL,0,-1 * SendMessage(hwnd, EM_EXLINEFROMCHAR, 0, (FindComponent('SynEdit'+IntToStr(Documents.ActivePage.TabIndex+1)) as TSynEdit).SelStart) ); (FindComponent('SynEdit'+IntToStr(Documents.ActivePage.TabIndex+1)) as TSynEdit).SelStart := SendMessage(hwnd,EM_LINEINDEX,Pos.Y,0); end; SendMessage(hwnd,EM_SCROLLCARET,0,0); Sendmessage(hwnd,EM_LINESCROLL,0, Pos.Y - 1); end; mfG mirage228 |
Re: "Gehe zu Zeile" in TRichEdit bzw. TSynEdit
:shock:
das Synedit hat doch (soweit ich weiß) CaretX und CaretY, womit du es auf eine gewünschte Zeikle setzen kannst, Warum so umständlich? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:20 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz