Autor Beitrag
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Mi 15.02.06 19:28 
Hi
Hat das JvRichEdit eine Funktion mit der ich den Index der selectierten Zeile bekomme?
Ansonsten muss ich mir die wohl selber schreiben. :gruebel:


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mo 20.02.2006 um 14:25
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Do 16.02.06 14:26 
Hi
Hab sie mir jetzt kurzerhand selber geschrieben. :)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
function TForm1.GetLineAtPos(Pos: Integer): Integer;
begin
  for Result := 0 to RichEdit1.Lines.Count - 1 do
    if (RichEdit1.GetLineIndex(Result) <= Pos) and
       (RichEdit1.GetLineIndex(Result) + Length(RichEdit1.Lines[Result]) >= Pos) then
      Break;
end;

Und so kann mans aufrufen
ausblenden Delphi-Quelltext
1:
ShowMessage(IntToStr(GetLineAtPos(Editor.SelStart)));					

:wave:
Coder Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: So 23.04.06 21:43 
Und hier das ganze nochmal ohne break; :)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
function TForm1.GetLineAtPos(Pos: Integer): Integer;
begin
  result := 0;
  while (RichEdit.GetLineIndex(result) > Pos) or
        (RichEdit.GetLineIndex(result) + Length(RichEdit.Lines[result]) < Pos) do
    inc(result);
end;