我在 delphi 7 上工作,我有一个应用程序,我在其中使用 action manager 创建 Action ,然后为它们分配快捷方式 操作管理器中的快捷方式已经在 shortcut 属性中定义..但我想要一个类似
的快捷方式 1. ADD ,that is the + on the numpad
2. Subtract key ,that is the - on the numpad
3. divide key , that is the / on the numpad.
4. enter key
我尝试将自己的快捷方式分配为subtract 和ADD 但它给了我这个错误信息
我也试过了 - 但什么也没发生
我的跟踪 Action 的代码
var
Action : TBasicAction;
begin
Action := Sender as TBasicAction;
if (Action is TAction) and not TAction(Action).Enabled then exit;
case Action.tag of
1 : ShowMessage('ADD + pressed');
2 : ShowMessage ('divide / pressed');
3 : ShowMessage ('subtract - pressed');
4 : ShowMessage ('enter pressed');
end;
end;
我可以正常使用
**GetKeyState(VK_ADD) AND 128)=128;** OR **GetKeyState(VK_return) AND 128)=128;**
要找到它,请按下键 在按键或按键事件中,但我想使用 Action 管理器快捷方式
最佳答案
您可以在运行时分配它们:
Action1.ShortCut := menus.ShortCut(VK_ADD, []);
Action2.ShortCut := menus.ShortCut(VK_SUBTRACT, []);
关于Delphi 操作管理器快捷键 +,-, enter 操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8655291/