Hi,
I have a menubar app, I would like to add a global keyboard shortcut, which works even when the menu is closed. I looked at the HotKeyMBS class but I can’t pass an alphabetic character (“w”) as a parameter with KeyCodeForText(“w”), or even with HotKeyMBS.KeyCode(keycode as integer). It works well with special characters (return, Fx, etc.) And then how do I display these shortcuts in my menu (nothing is displayed)? Is this the right approach?
App.Opening()
Var keyCodeReturn As Integer = HotKeyMBS.KeyCodeForText("w")
HotKeyReturn = new MyHotKey(keyCodeReturn, HotKeyMBS.CommandKey + HotKeyMBS.ControlKey) //CMD + CTRL + "W"
I started with MBS’s ‘Mouse Click & Keyboard Events’ example.
in the KeyDown event of the AppEvenMonitor in the main window’s controls, I have this code:
If KeyCode = 115 Then //this is the Home key
If mc.ShiftKey Or mc.AltKey Or mc.CtrlKey Then
Return//if any of these keys are pressed, exit from routine
End If
If mc.CmdKey Then
AutoCollapse() //executes code for Command + Home key
End If
Return
End If