mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 10:19:16 +02:00
lcl: fix filtering of unicode char in dbedit issue #14679
git-svn-id: trunk@35536 -
This commit is contained in:
parent
464767f88f
commit
46ef55241c
@ -184,7 +184,7 @@ Type
|
|||||||
function GetReadOnly: Boolean; override;
|
function GetReadOnly: Boolean; override;
|
||||||
procedure SetReadOnly(Value: Boolean); override;
|
procedure SetReadOnly(Value: Boolean); override;
|
||||||
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
|
||||||
procedure KeyPress(var Key: char); override;
|
procedure UTF8KeyPress(var UTF8Key: TUTF8Char); override;
|
||||||
|
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
|
|
||||||
|
@ -126,36 +126,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBEdit.KeyPress(var Key: char);
|
procedure TDBEdit.UTF8KeyPress(var UTF8Key: TUTF8Char);
|
||||||
var
|
var
|
||||||
SavedKey: Char;
|
CharKey: Char;
|
||||||
begin
|
begin
|
||||||
SavedKey := Key;
|
inherited UTF8KeyPress(UTF8Key);
|
||||||
inherited KeyPress(Key);
|
//If the pressed key is unicode then map the char to #255
|
||||||
//TCustomMaskEdit sets all normal Keys (and BackSpace) to #0 if IsMasked
|
//Necessary to keep the TField.IsValidChar check
|
||||||
//but not if control is ReadOnly
|
if Length(UTF8Key) = 1 then
|
||||||
if (not IsMasked) or (inherited ReadOnly) then
|
CharKey := UTF8Key[1]
|
||||||
begin
|
|
||||||
case Key of
|
|
||||||
#8: // special keys
|
|
||||||
if not FDatalink.Edit then
|
|
||||||
Key:=#0;
|
|
||||||
|
|
||||||
#32..#255: //standard keys
|
|
||||||
if not FieldCanAcceptKey(FDataLink.Field, Key) or not FDatalink.Edit then
|
|
||||||
Key:=#0;
|
|
||||||
end;//case
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
begin
|
CharKey := #255;
|
||||||
case SavedKey of
|
|
||||||
#8: // special keys
|
case CharKey of
|
||||||
FDatalink.Edit;
|
#8: // special keys
|
||||||
#32..#255: //standard keys
|
if not FDatalink.Edit then
|
||||||
if FieldCanAcceptKey(FDataLink.Field, SavedKey) then
|
UTF8Key:='';
|
||||||
FDatalink.Edit;
|
|
||||||
end;//case
|
#32..#255: //standard keys
|
||||||
end;
|
if not FieldCanAcceptKey(FDataLink.Field, CharKey) or not FDatalink.Edit then
|
||||||
|
UTF8Key:='';
|
||||||
|
end;//case
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDBEdit.Notification(AComponent: TComponent; Operation: TOperation);
|
procedure TDBEdit.Notification(AComponent: TComponent; Operation: TOperation);
|
||||||
|
Loading…
Reference in New Issue
Block a user