Cocoa: Fix the issue that the Space key on the Button does not work

This commit is contained in:
rich2014 2024-02-24 16:31:47 +08:00
parent 82784f13b1
commit b0bb460a46
2 changed files with 5 additions and 2 deletions

View File

@ -371,8 +371,10 @@ end;
procedure TCocoaButton.keyDown(event: NSEvent); procedure TCocoaButton.keyDown(event: NSEvent);
begin begin
if event.keyCode = kVK_Space then if event.keyCode = kVK_Space then begin
lclCheckMixedAllowance; lclCheckMixedAllowance;
inherited keyDown(event);
end;
end; end;
function TCocoaButton.performKeyEquivalent(event: NSEvent): LCLObjCBoolean; function TCocoaButton.performKeyEquivalent(event: NSEvent): LCLObjCBoolean;

View File

@ -648,7 +648,8 @@ var
textView: NSView; textView: NSView;
isFirst: Boolean; isFirst: Boolean;
begin begin
if (not _inIME) and (theEvent.keyCode in [kVK_Return, kVK_ANSI_KeypadEnter, kVK_Escape]) then if (not _inIME) and (theEvent.keyCode in
[kVK_Return, kVK_ANSI_KeypadEnter, kVK_Escape, kVK_Space]) then
begin begin
inherited; inherited;
exit; exit;