summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2012-09-26 22:22:37 +0100
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2012-09-26 22:22:37 +0100
commita37b44fabbfe9db5e10bad4c1a3e67c3d55ccae8 (patch)
treeefa371b4a572b8ccfe73baadc7e7a4f8f16cca7e
parent345e2c2047c2b2e388ff6ade61aea4b5e505c151 (diff)
downloadfpGUI-a37b44fabbfe9db5e10bad4c1a3e67c3d55ccae8.tar.xz
You can now copy to clipboard the content of message dialogs.
The TfpgMessageDialog and TfpgMessageBox dialogs now support the "copy to clipboard" keyboard shortcuts. This is nice and handy for pasting an error message into an email or something.
-rw-r--r--src/gui/fpg_dialogs.pas18
-rw-r--r--src/gui/messagedialog.inc16
2 files changed, 25 insertions, 9 deletions
diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas
index baa2bb92..8f3639e6 100644
--- a/src/gui/fpg_dialogs.pas
+++ b/src/gui/fpg_dialogs.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -450,10 +450,18 @@ end;
procedure TfpgMessageBox.FormKeyPressed(Sender: TObject; var KeyCode: word;
var ShiftState: TShiftState; var Consumed: boolean);
begin
- if KeyCode = keyEscape then
- begin
- Consumed := False;
- Close;
+ case CheckClipBoardKey(keycode, shiftstate) of
+ ckCopy:
+ begin
+ fpgClipboard.Text := FLines.Text;
+ Consumed := True;
+ end;
+ else
+ if KeyCode = keyEscape then
+ begin
+ Consumed := True;
+ Close;
+ end;
end;
end;
diff --git a/src/gui/messagedialog.inc b/src/gui/messagedialog.inc
index f5651c7a..0c5c1f24 100644
--- a/src/gui/messagedialog.inc
+++ b/src/gui/messagedialog.inc
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -330,10 +330,18 @@ end;
procedure TfpgMessageDialog.HandleKeyPress(var keycode: word;
var shiftstate: TShiftState; var consumed: boolean);
begin
- if keycode = keyEscape then // Esc cancels the dialog
- ModalResult := mrCancel
+ case CheckClipBoardKey(keycode, shiftstate) of
+ ckCopy:
+ begin
+ fpgClipboard.Text := Text + LineEnding + LineEnding + InformativeText;
+ Consumed := True;
+ end;
else
- inherited HandleKeyPress(keycode, shiftstate, consumed);
+ if keycode = keyEscape then // Esc cancels the dialog
+ ModalResult := mrCancel
+ else
+ inherited HandleKeyPress(keycode, shiftstate, consumed);
+ end;
end;
procedure TfpgMessageDialog.PrepareLayout;