summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-12 19:55:05 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-12 19:55:05 +0000
commitd8ae4e50861f1db94db3ac92bef07c80b1b2ecb0 (patch)
treea9c084152a34cec2d310e6d7f67d7585501257dd /src/gui
parent9e1647d2eacc4c76aaa5ac194702d9d397b4354a (diff)
downloadfpGUI-d8ae4e50861f1db94db3ac92bef07c80b1b2ecb0.tar.xz
* The start of clipboard support. Currently on Text is support and the clipboard only works inside the current running application. Next step is OS (global) based clipboard support.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui_edit.pas42
1 files changed, 27 insertions, 15 deletions
diff --git a/src/gui/gui_edit.pas b/src/gui/gui_edit.pas
index a421b9c6..ab02d9be 100644
--- a/src/gui/gui_edit.pas
+++ b/src/gui/gui_edit.pas
@@ -59,7 +59,8 @@ function CreateEdit(AOwner: TComponent; x, y, w, h: TfpgCoord): TfpgEdit;
implementation
uses
- gfx_UTF8utils;
+ gfx_UTF8utils,
+ gfx_clipboard;
function CreateEdit(AOwner: TComponent; x, y, w, h: TfpgCoord): TfpgEdit;
begin
@@ -153,7 +154,7 @@ procedure TfpgEdit.DoCopy;
begin
if FSelOffset = 0 then
Exit;
- //SetClipboardText(SelectionText);
+ fpgClipboard.Text := SelectionText;
end;
procedure TfpgEdit.DoPaste;
@@ -161,7 +162,8 @@ var
s: string;
begin
DeleteSelection;
- //s := GetClipboardText;
+ s := fpgClipboard.Text;
+
if (FMaxLength > 0) then
if UTF8Length(FText) + UTF8Length(s) > FMaxLength then
s := UTF8Copy(s, 1, FMaxLength - UTF8Length(FText)); // trim the clipboard text if needed
@@ -294,7 +296,7 @@ procedure TfpgEdit.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
var
lpos: integer;
-
+
procedure StopSelection;
begin
FSelStart := FCursorPos;
@@ -305,19 +307,29 @@ begin
// writeln(Classname, '.Keypress');
Consumed := False;
lpos := FCursorPos;
-{
- Consumed := true;
- case ptkCheckClipBoardKey(keycode, shiftstate) of
- ckCopy: DoCopy;
- ckPaste: DoPaste;
- ckCut: begin
- DoCopy;
- DeleteSelection;
- end;
+
+ Consumed := True;
+ case CheckClipBoardKey(keycode, shiftstate) of
+ ckCopy:
+ begin
+// writeln('ckCopy');
+ DoCopy;
+ end;
+ ckPaste:
+ begin
+// writeln('ckPaste');
+ DoPaste;
+ end;
+ ckCut:
+ begin
+// writeln('ckCut');
+ DoCopy;
+ DeleteSelection;
+ end;
else
- Consumed := false;
+ Consumed := False;
end;
-}
+
if not Consumed then
begin