如何在应用程序中创建热键? [英] How to create Hotkey in application..?

查看:114
本文介绍了如何在应用程序中创建热键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个需要热键的应用程序,但是我的算法无法正常工作.我的算法仅在应用程序位于顶部时才能运行,否则无法正常工作.

I want to create one application which required hotkey but my algorithm is not working properly.My algorithm only works when application is on top otherwise it is not working.

推荐答案

看看以下代码项目文章启用Hotkey和ShortcutInput用户控件的简单步骤 [ ^ ],解释得很整洁.
Take a look at the following code project article, Simple steps to enable Hotkey and ShortcutInput user control[^], very neatly explained.


为应用程序创建键盘快捷键:

选择苹果菜单>单击系统偏好设置,然后单击键盘和鼠标.


单击键盘快捷键,然后单击添加(+)按钮.


从应用程序"弹出菜单中选择一个应用程序.如果要为出现在许多应用程序中的菜单命令设置相同的组合键,请选择所有应用程序".

如果要选择的应用程序未出现在列表中,请选择其他",然后使用打开"对话框找到该应用程序.某些应用程序可能不允许您设置键盘快捷键.


在菜单标题"字段中键入要为其设置键盘快捷键的菜单命令.

您必须完全按照应用程序菜单中显示的命令键入命令,包括省略号和任何其他标点符号.省略号是一个特殊字符,看起来像三个句点.要键入省略号,请按Option分号或使用字符面板".可能很难知道命令是用真正的省略号还是用三个句点写在菜单中的,因此,如果一个命令不起作用,请尝试另一个命令.


单击键盘快捷键"字段,然后按要分配给菜单命令的组合键,然后单击添加".

您不能在一个键组合中多次使用每种键(例如,字母键).


退出为其添加或更改了键盘快捷键的应用程序.


重新启动应用程序以查看应用程序菜单中的键盘快捷键.
To create a keyboard shortcut for an application:

Choose Apple menu > System Preferences, and then click Keyboard & Mouse.


Click Keyboard Shortcuts, and then click the Add (+) button.


Choose an application from the Application pop-up menu. If you want to set the same key combination for a menu command that appears in many applications, choose All Applications.

If the application you want to select does not appear in the list, choose Other and locate the application using the Open dialog. Some applications may not allow you to set keyboard shortcuts.


Type the menu command for which you want to set a keyboard shortcut in the Menu Title field.

You must type the command exactly as it appears in the application menu, including ellipses and any other punctuation. An ellipsis is a special character that looks like three periods. To type an ellipsis, press Option-semicolon, or use the Character Palette. It may be difficult to know whether the command is written in the menu with a real ellipsis or with three periods, so if one does not work, try the other.


Click in the Keyboard Shortcut field and press the key combination that you want to assign to the menu command, and then click Add.

You cannot use each type of key (for example, a letter key) more than once in a key combination.


Quit the application for which you added or changed a keyboard shortcut.


Restart the application to see the keyboard shortcut in the application’s menu.


这篇关于如何在应用程序中创建热键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆