mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 15:19:40 +02:00
LCL-CustomDrawn: Improve TEdit key press events. Issue #40221, patch by Alexey Torgashin.
This commit is contained in:
parent
027553282a
commit
9e69dd9798
@ -288,7 +288,7 @@ end;
|
||||
procedure CallbackKeyChar(AWindowHandle: TCDForm; AKeyData: Word; AChar: TUTF8Char);
|
||||
var
|
||||
lTarget: TWinControl;
|
||||
lCharCode: Word = 0;
|
||||
lCharCode: Word;
|
||||
begin
|
||||
lTarget := AWindowHandle.GetFocusedControl();
|
||||
{$ifdef VerboseCDEvents}
|
||||
@ -296,17 +296,20 @@ begin
|
||||
{$endif}
|
||||
|
||||
if lTarget = nil then Exit; // Fixes a crash
|
||||
if Length(AChar) = 1 then lCharCode := Word(AChar[1]);
|
||||
if Length(AChar) = 1 then
|
||||
lCharCode := Byte(AChar[1])
|
||||
else
|
||||
lCharCode:=0;
|
||||
|
||||
// if lCharCode <> 0 then LCLSendCharEvent(lTarget, lCharCode, AKeyData, True, False, True);
|
||||
LCLSendUTF8KeyPress(lTarget, AChar, False);
|
||||
if AChar<>'' then LCLSendUTF8KeyPress(lTarget, AChar, False);
|
||||
if lCharCode <> 0 then LCLSendCharEvent(lTarget, lCharCode, AKeyData, True, False, True);
|
||||
|
||||
// If this is a interface control, send the message to the main LCL control too
|
||||
if IsIntfControl(lTarget) then
|
||||
begin
|
||||
lTarget := lTarget.Parent;
|
||||
// if lCharCode <> 0 then LCLSendCharEvent(lTarget, lCharCode, AKeyData, True, False, True);
|
||||
LCLSendUTF8KeyPress(lTarget, AChar, False);
|
||||
if AChar<>'' then LCLSendUTF8KeyPress(lTarget, AChar, False);
|
||||
if lCharCode <> 0 then LCLSendCharEvent(lTarget, lCharCode, AKeyData, True, False, True);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user