Autor Beitrag
colaka
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 4

Win XP, W7
Delphi 2005 Prof.
BeitragVerfasst: Sa 01.01.11 10:50 
Hallo,

ich habe mir mit Hilfe von Richedit einen kleinen Editor geschrieben und möchte in der Statusbar gerne eine Anzeige wie "Zeile Nr X von Zeilenanzahl" haben.

Die Zeilenanzahl ist kein Problem. Ich erhalte sie mit:
ausblenden Delphi-Quelltext
1:
  FHaupt.StatusBar.Panels.Items[3].Text := IntToStr(RichEdit.Lines.Count);					


Aber für die Zeilennummer finde ich keine vorgefertigte Eigenschaft.

Oder wie könnte man das Problem lösen?

Danke Ebi
ssb-blume
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 375
Erhaltene Danke: 7

XP, W7, W8
Deutschland
BeitragVerfasst: Sa 01.01.11 10:58 
Such mal unter GetLineIndex!
Hansi

_________________
Brain: an apparatus with which we think we think.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Sa 01.01.11 11:02 
Richedit.ActiveLineNo

0-basiert

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
colaka Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 4

Win XP, W7
Delphi 2005 Prof.
BeitragVerfasst: Sa 01.01.11 11:09 
Hallo,

vielen Dank für die schnellen Antworten, aber sowohl mit GetLineIndex wie auch mit ActiveLineNo erhalte ich die Fehlermeldung "undefinierter Bezeichner".

Muß ich da vielleicht noch irgendeine Unit einbinden?

Gruß Ebi
Gerd Kayser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 632
Erhaltene Danke: 121

Win 7 32-bit
Delphi 2006/XE
BeitragVerfasst: Sa 01.01.11 11:11 
Das könnte Dir eventuell weiter helfen: www.delphi-forum.de/...light=emgetlinecount

Für diesen Beitrag haben gedankt: colaka
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Sa 01.01.11 11:15 
@colaka
hab leider grade nur Delphi 2010 zum spicken, sorry.

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
colaka Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 4

Win XP, W7
Delphi 2005 Prof.
BeitragVerfasst: Sa 01.01.11 13:02 
Hallo,

ich habe jetzt stundenlang das Forum und Google durchsucht, aber immer noch keinen Lösungsansatz gefunden. Es gibt zwar Lösungen, wie die mit GetLineIndex, aber die beziehen sich nicht auf die Standard-RichEdit-Komponente, sondern auf RxRichEdit oder JvRichEdit. Die scheint es aber beide nicht als einzelne Komponente, sondern nur in riesigen Komplettpaketen zu geben. Das will ich mir nicht unbedingt antun.

Auf der anderen Seite kann ich mir nicht so recht vorstellen, daß es für das normale RichEdit keine Möglichkeit geben soll, um festzustellen, in welcher Zeile der Cursor steht.

Danke Ebi
Stundenplan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128
Erhaltene Danke: 32

Win 7
Delphi 7 Pers., C# (VS 2010 Express)
BeitragVerfasst: Sa 01.01.11 13:51 
Also das (www.swissdelphicente.../showcode.php?id=165) funktioniert bei mir einwandfrei!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
function RichRow(m: TCustomMemo): Longint;
begin
  Result := SendMessage(m.Handle, EM_LINEFROMCHAR, m.SelStart, 0);
end;


EDIT: Oder in RichEdit.CaretPos.Y steht die Zeile auch!

Viele Grüße,
Stundenplan.

Für diesen Beitrag haben gedankt: colaka
colaka Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 200
Erhaltene Danke: 4

Win XP, W7
Delphi 2005 Prof.
BeitragVerfasst: Sa 01.01.11 14:11 
Ja,

danke. Jetzt habe ich es auch hinbekommen