From 2b0d38d8b655a92a1cfb1ee0d252917f9a18dbc8 Mon Sep 17 00:00:00 2001 From: bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Sat, 6 Jul 2013 12:57:26 +0000 Subject: [PATCH] TPromptDialog: handle Ctrl+C (copy MSG to clipboard). Issue #0016295. git-svn-id: trunk@42005 - --- lcl/dialogs.pp | 2 +- lcl/include/promptdialog.inc | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp index 0f8714ad95..38a0a708bd 100644 --- a/lcl/dialogs.pp +++ b/lcl/dialogs.pp @@ -23,7 +23,7 @@ interface uses Types, typinfo, Classes, LResources, SysUtils, LCLIntf, InterfaceBase, FileUtil, LCLStrConsts, LCLType, LCLProc, Forms, Controls, Themes, GraphType, - Graphics, Buttons, ButtonPanel, StdCtrls, ExtCtrls, LCLClasses; + Graphics, Buttons, ButtonPanel, StdCtrls, ExtCtrls, LCLClasses, ClipBrd; type diff --git a/lcl/include/promptdialog.inc b/lcl/include/promptdialog.inc index 067ca6c7ad..37bd1f7745 100644 --- a/lcl/include/promptdialog.inc +++ b/lcl/include/promptdialog.inc @@ -17,6 +17,8 @@ type private FCancelKind: TBitBtnKind; function CreateButtons(AVerticalLayout: Boolean; ASpacing: Integer): Integer; + protected + procedure KeyDown(var Key: Word; Shift: TShiftState); override; public IsSmallDevice: Boolean; @@ -89,6 +91,16 @@ begin DefaultButton.Default := True; end; +procedure TPromptDialog.KeyDown(var Key: Word; Shift: TShiftState); +begin + inherited KeyDown(Key, Shift); + if (Shift = [ssModifier]) and (Key = VK_C) then + begin + Key := 0; + ClipBoard.AsText := MSG; + end; +end; + procedure TPromptDialog.Paint; var UseMaskHandle: HBitmap; @@ -111,13 +123,14 @@ begin end; constructor TPromptDialog.CreateMessageDialog(const ACaption, aMsg: string; - DialogType : longint; TheButtons: PLongint; ButtonCount, DefaultIndex : Longint); + DialogType: Longint; TheButtons: PLongint; ButtonCount, DefaultIndex: Longint + ); var curBtn: Integer; curKind: TBitBtnKind; begin inherited CreateNew(nil, 1); - + KeyPreview := True; //needed for capturing Ctrl+C in KeyDown IsSmallDevice := (Screen.Width <= 300); AutoScroll := False;