summaryrefslogtreecommitdiff
path: root/prototypes
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2009-08-02 23:32:49 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2009-08-02 23:32:49 +0200
commit424a32b9f5087ec42dc778797d71782e4f5ca5b4 (patch)
tree19b26148675c9692d0f58dcfe3127829aaf88ae2 /prototypes
parentf0b97fa0cd4b5a2a9112000e56339bfe1327518e (diff)
downloadfpGUI-424a32b9f5087ec42dc778797d71782e4f5ca5b4.tar.xz
Implements Up Arrow key navigation in TextEdit component.
Signed-off-by: Graeme Geldenhuys <graemeg@gmail.com>
Diffstat (limited to 'prototypes')
-rw-r--r--prototypes/textedit/fpg_textedit.pas36
1 files changed, 36 insertions, 0 deletions
diff --git a/prototypes/textedit/fpg_textedit.pas b/prototypes/textedit/fpg_textedit.pas
index fcc14626..d076f056 100644
--- a/prototypes/textedit/fpg_textedit.pas
+++ b/prototypes/textedit/fpg_textedit.pas
@@ -779,6 +779,42 @@ begin
keyUp:
begin
+ if CaretPos.x = 0 then Exit;
+ if not (ssShift in ShiftState) and not (ssCtrl in ShiftState) then
+ begin
+ CaretPos.Y := CaretPos.Y - 1;
+ if FSelected then
+ begin
+ FSelected := False;
+ Exit;
+ end;
+ FSelStartNo := CaretPos.Y;
+ Exit;
+ end;
+ if (ssCtrl in ShiftState) and not (ssShift in ShiftState) then
+ begin
+ CaretPos.Y := CaretPos.Y - 1;
+ UpdateScrollBars;
+ FSelStartNo := CaretPos.Y;
+ Exit;
+ end;
+ if not (ssCtrl in ShiftState) and (ssShift in ShiftState) then
+ begin
+ CaretPos.Y := CaretPos.Y - 1;
+ if not FSelected then
+ begin
+ FSelStartNo := CaretPos.Y + 1;
+ FSelStartOffs := CaretPos.X;
+ FSelEndNo := CaretPos.X;
+ FSelEndOffs := CaretPos.X;
+ FSelected := True;
+ end else
+ begin
+ FSelEndNo := CaretPos.Y;
+ FSelEndOffs := CaretPos.X;
+ FSelected := (FSelStartNo <> FSelEndNo) or (FSelStartOffs <> FSelEndOffs);
+ end;
+ end;
end;
keyDown: