With the help of Dave DeLong and others on stackoverflow I've given my tutorial app a cool hotkey effect but I can't figure out how to make it instantiate the window.
I have the following setup:
A calculator that is not active when first run but has a NSStatusItem icon and menu, with a menu option that opens the main window.
Also, I have added DDHotKeyCenter.h and DDHotKeyCenter to the directory + linked the Carbon.framework.
The NSStatusMenu is connected to the window through:
-(IBAction)activateMain:(id)sender{
[NSApp activateIgnoringOtherApps:YES];}
What I was wondering is if it's possible to connect the actions fired by the hotkey, using the Blocks method, to the IBAction directly, or if there's some intermediate step to connect them?
Would it be better to have the DDHotKey fire an NSEvent, or can it even do that?
I seem to be a bit confused about it's implementation.
DDHotKey does not "fire an NSEvent". It invokes a method on an object. You could very easily set up your hotkey to fire the
activateMain:
method of whatever object owns it:Or if you wanted to use a block, you could do: