Delphi 操作管理器快捷键 +,-, enter 操作

标签 delphi keyboard-shortcuts delphi-7

我在 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

我尝试将自己的快捷方式分配为subtractADD 但它给了我这个错误信息 enter image description here

我也试过了 - 但什么也没发生

我的跟踪 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/

相关文章:

delphi - 文件 MD5 校验和

delphi - delphi记录之间的交叉引用

德尔福 2007 : save only the breakpoint options in the DSK file?

c# - 用于查看/应用可用重构的键盘快捷键

xcode - 如何在 XCode 中快速删除/* 和 */

c# - 重新创建 C# `Struct` 版本的 Delphi `Record` - 作为参数传递到 DLL

windows - 如何将项目添加到右键单击文件夹菜单?

delphi - 处理DbExpress SQL错误代码245

delphi - DUnit GUI 测试 : Can I force 'Application' to a different "form"?

visual-studio-code - 使用键盘触发高级悬停信息