LCL-CustomDrawn: Implements support for TCDEdit.ReadOnly

git-svn-id: trunk@39446 -
This commit is contained in:
sekelsenmat 2012-12-06 09:46:47 +00:00
parent 2860e13007
commit 8624b78a67
2 changed files with 6 additions and 0 deletions

View File

@ -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), <enter>, ESC, etc
// Don't handle any non-char keys here because they are already handled in KeyDown

View File

@ -1302,6 +1302,7 @@ begin
ACDControlField.Caption := AWinControl.Caption;
ACDControlField.Parent := AWinControl;
ACDControlField.Align := alClient;
TCDIntfEdit(ACDControlField).ReadOnly := TCustomEdit(AWinControl).ReadOnly;
end;
{------------------------------------------------------------------------------