Designer: AskCompNameDlg: Ctrl+Enter applies dialog, select all when TextMemo is focused

git-svn-id: trunk@58261 -
This commit is contained in:
ondrej 2018-06-14 10:13:05 +00:00
parent b7a40b3691
commit 430876f35c
2 changed files with 18 additions and 1 deletions

View File

@ -8,7 +8,9 @@ object AskCompNameDialog: TAskCompNameDialog
Caption = 'AskCompNameDialog'
ClientHeight = 224
ClientWidth = 393
KeyPreview = True
OnCreate = FormCreate
OnKeyDown = FormKeyDown
Position = poScreenCenter
LCLVersion = '1.9.0.0'
object NameLabel: TLabel
@ -101,6 +103,7 @@ object AskCompNameDialog: TAskCompNameDialog
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
OnChange = NameEditChange
OnEnter = TextMemoEnter
ParentShowHint = False
ScrollBars = ssAutoBoth
ShowHint = True

View File

@ -28,7 +28,7 @@ interface
uses
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics,
Dialogs, StdCtrls, ButtonPanel, ExtCtrls, PropEdits, LazarusIDEStrConsts,
TypInfo;
TypInfo, LCLType;
type
@ -42,7 +42,9 @@ type
NameEdit: TEdit;
NameLabel: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure NameEditChange(Sender: TObject);
procedure TextMemoEnter(Sender: TObject);
private
FLookupRoot: TComponent;
FNewComponent: TComponent;
@ -198,6 +200,13 @@ begin
ButtonPanel1.OKButton.Enabled:=false;
end;
procedure TAskCompNameDialog.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=VK_RETURN) and (ssCtrl in Shift) then
ButtonPanel1.OKButton.Click;
end;
function TAskCompNameDialog.GetNewText: string;
begin
Result := TextMemo.Text;
@ -242,6 +251,11 @@ begin
TextMemo.Text := '';
end;
procedure TAskCompNameDialog.TextMemoEnter(Sender: TObject);
begin
TextMemo.SelectAll;
end;
function TAskCompNameDialog.IsValidName(AName: TComponentName; out
ErrorMsg: string): boolean;
var