summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-07-16 18:51:35 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-07-16 18:51:35 +0200
commit2f2f69d36678d95ee11351c858cdb38188656831 (patch)
tree85b40a129dcad43c2e4cf4be2b86aab3a45a5f3e
parent2f42a040fa69f77bd4e14584785b657b441d19ff (diff)
downloadfpGUI-2f2f69d36678d95ee11351c858cdb38188656831.tar.xz
added GotoLine() method to the TextEdit component
-rw-r--r--src/fpg_textedit.pas8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/fpg_textedit.pas b/src/fpg_textedit.pas
index e6aab639..8cd13a0c 100644
--- a/src/fpg_textedit.pas
+++ b/src/fpg_textedit.pas
@@ -157,6 +157,7 @@ type
procedure GetRowColAtPos(const X, Y: Integer; out Row, Col: Integer);
procedure Clear;
procedure ScrollTo(X, Y: Integer);
+ procedure GotoLine(ALine: integer);
procedure DeleteSelection;
procedure SaveToFile(const AFileName: TfpgString);
procedure LoadFromFile(const AFileName: TfpgString);
@@ -1719,6 +1720,13 @@ begin
SetHPos(X div FChrW);
end;
+procedure TfpgBaseTextEdit.GotoLine(ALine: integer);
+begin
+ CaretPos.X := 0;
+ CaretPos.Y := ALine;
+ ScrollPos_V := ALine-5; // scrolling a few lines short so cursor is not on top line
+end;
+
procedure TfpgBaseTextEdit.DeleteSelection;
begin
{ TODO : Implement DeleteSelection }