From 8624b78a67ab90e573c3f0f29a533a1d5fe2d1f7 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 6 Dec 2012 09:46:47 +0000 Subject: [PATCH] LCL-CustomDrawn: Implements support for TCDEdit.ReadOnly git-svn-id: trunk@39446 - --- lcl/customdrawncontrols.pas | 5 +++++ lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas | 1 + 2 files changed, 6 insertions(+) diff --git a/lcl/customdrawncontrols.pas b/lcl/customdrawncontrols.pas index dfa6ee4ab1..0c1096effa 100644 --- a/lcl/customdrawncontrols.pas +++ b/lcl/customdrawncontrols.pas @@ -199,6 +199,7 @@ type FCaretTimer: TTimer; FLines: TStrings; FOnChange: TNotifyEvent; + FReadOnly: Boolean; function GetLeftTextMargin: Integer; function GetMultiLine: Boolean; function GetRightTextMargin: Integer; @@ -253,6 +254,7 @@ type property Enabled; property Lines: TStrings read FLines write SetLines; property MultiLine: Boolean read GetMultiLine write SetMultiLine default False; + property ReadOnly: Boolean read FReadOnly write FReadOnly default False; property TabStop default True; property OnChange: TNotifyEvent read FOnChange write FOnChange; end; @@ -1868,6 +1870,9 @@ var begin inherited UTF8KeyPress(UTF8Key); + // ReadOnly disables key input + if FReadOnly then Exit; + // LCL-Carbon sends Backspace as a UTF-8 Char // LCL-Qt sends arrow left,right,up,down (#28..#31), , ESC, etc // Don't handle any non-char keys here because they are already handled in KeyDown diff --git a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas index c158d6ccec..f0e90243b9 100644 --- a/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas +++ b/lcl/interfaces/customdrawn/customdrawnwsstdctrls.pas @@ -1302,6 +1302,7 @@ begin ACDControlField.Caption := AWinControl.Caption; ACDControlField.Parent := AWinControl; ACDControlField.Align := alClient; + TCDIntfEdit(ACDControlField).ReadOnly := TCustomEdit(AWinControl).ReadOnly; end; {------------------------------------------------------------------------------