summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-28 20:01:50 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-08-29 22:19:02 +0200
commit903fef27ec7f1cde49a038cfd8f9397328bc9a1e (patch)
tree62584d18a004d90d4fd2cac5ec8965ed9244951b /examples
parent1f2922e8d72139db46ebee4d7cfba90173beda28 (diff)
downloadfpGUI-903fef27ec7f1cde49a038cfd8f9397328bc9a1e.tar.xz
textedit: rudimentary TAB key press implementation.
* We don't support the TAB character yet, just the insertion of spaces equal to a set width. * Also included the dbugintf unit so we can use the fpGUI Debug Server to help debug our IDE.
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas36
1 files changed, 35 insertions, 1 deletions
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index e0834106..e54a7a20 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.pas
@@ -203,7 +203,12 @@ type
implementation
uses
- fpg_dialogs{, fpg_constants}, fpg_stringutils, fpg_utils, math;
+ fpg_dialogs,
+// fpg_constants,
+ fpg_stringutils,
+ fpg_utils,
+ math,
+ dbugintf;
function GetNextWord(SLine: TfpgString; var PosX: Integer): Boolean;
@@ -1299,11 +1304,31 @@ var
Y: Integer;
X: Integer;
CaretScroll: Boolean;
+ HasChanged: boolean;
begin
{$IFDEF gDEBUG}
writeln('>> TfpgBaseTextEdit.HandleKeyPress');
{$ENDIF}
// inherited HandleKeyPress(keycode, shiftstate, consumed);
+ case CheckClipboardKey(keycode, shiftstate) of
+ ckCopy:
+ begin
+// DoCopy;
+ end;
+
+ ckPaste:
+ begin
+// DoPaste(fpgClipboard.Text);
+// if not ReadOnly then
+// HasChanged := True;
+ end;
+
+ ckCut:
+ begin
+// DoCopy;
+// DeleteSection;
+ end;
+ end;
{ Add lines as we go, so we can cursor past EOF. }
{ todo: This behaviour should be optional }
@@ -1359,6 +1384,15 @@ begin
keyTab:
begin
+ AddS := ' ';
+ SendDebug('b: ' + SLine);
+ UTF8Insert(AddS, SLine, CaretPos.X);
+ SendDebug('a: ' + SLine);
+ FLines[CaretPos.Y] := SLine;
+ CaretPos.X := CaretPos.X + 2;
+ FSelStartNo := CaretPos.Y;
+ FSelStartOffs := CaretPos.X;
+ consumed := True;
end;
keyReturn: