Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HotkeyListener without modifier #2

Closed
woth2k3 opened this issue May 25, 2020 · 7 comments
Closed

HotkeyListener without modifier #2

woth2k3 opened this issue May 25, 2020 · 7 comments
Labels
question Further information is requested

Comments

@woth2k3
Copy link

woth2k3 commented May 25, 2020

Hi!

Is it possible to have it without modifier keys?

@woth2k3
Copy link
Author

woth2k3 commented May 25, 2020

And one more question: why am I restricted to two modifiers and one key? I it possible to set only one modifier and one key?

@Willy-Kimura
Copy link
Owner

Hello,

For your first question, yes it's very possible to add a hotkey without modifiers. Simply set a hotkey's modifiers to Keys.None. Here's an example:

[C#]
Hotkey hotkey1 = new Hotkey(Keys.None, Keys.T);

[VB]
Dim hotkey1 As New Hotkey(Keys.None, Keys.T)

For your second question, there is no restriction to setting modifiers and keys. If you may have noticed in the documentation, there are also some examples with only one modifier and a key.

@Willy-Kimura Willy-Kimura added the question Further information is requested label May 25, 2020
@woth2k3
Copy link
Author

woth2k3 commented May 25, 2020

I don't know what I was doing, but it's working with only one modifier, that's correct.

However, with "Keys. None" I have 'System.Exception: 'No hotkey registered.''

Untitled-1

Many thanks!

@woth2k3
Copy link
Author

woth2k3 commented May 26, 2020

For your second question, there is no restriction to setting modifiers and keys. If you may have noticed in the documentation, there are also some examples with only one modifier and a key.

Well, actually, if it's only Shift+Key, there is an error, the hot key is not registered. Control+Key and Alt+Key, Control+Shift+Key and so on are working fine.

@Willy-Kimura
Copy link
Owner

Okay. I'll test a scenario with no modifiers and let you know.

@Willy-Kimura
Copy link
Owner

Willy-Kimura commented Jun 4, 2020

You can now checkout the latest release.
I've added support for registering hotkeys without modifiers.

Example:

var hotkey1 = new Hotkey(Keys.Q);
hkl.Add(hotkey1);

Have fun!

@woth2k3
Copy link
Author

woth2k3 commented Jun 4, 2020

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants