【发布时间】:2012-10-04 07:44:14
【问题描述】:
对于 Windows 的 Delphi,我通常使用以下代码:
function isCtrlDown : Boolean;
var
ksCurrent : TKeyboardState;
begin
GetKeyboardState(ksCurrent);
Result := ((ksCurrent[VK_CONTROL] and 128) <> 0);
end;
如何在 Mac OSX 上使用 FireMonkey 实现这一目标?
我找到了this,但我不知道如何使用 FireMonkey/Delphi(它使用...)来管理它:
void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
{
UInt32 currentModifiers = GetCurrentKeyModifiers();
shiftKey = currentModifiers & ::shiftKey;
ctrlKey = currentModifiers & ::controlKey;
altKey = currentModifiers & ::optionKey;
metaKey = currentModifiers & ::cmdKey;
}
我还在调查...
目前,我发现这个单元有 key events 的东西......
unit Macapi.AppKit;
【问题讨论】:
标签: macos delphi delphi-xe2 firemonkey keyevent