PDA

View Full Version : Key Commands and How to Listen for them




DeviledMoon
Oct 22, 2010, 03:56 PM
Hey Guys,

Just wondering, lets say i want to connect the function (OpenApple+Fn+1) to load a menu item.

How abouts would i go about listening for the command and or listening for menu item clicks

i know it has to all be linked, but how would i listen for the commands?

Thanks,
DeviledMoon



HiRez
Oct 22, 2010, 04:46 PM
Hey Guys,

Just wondering, lets say i want to connect the function (OpenApple+Fn+1) to load a menu item.

How abouts would i go about listening for the command and or listening for menu item clicks

i know it has to all be linked, but how would i listen for the commands

Assuming you are using Cocoa + Obj-C, if it's assigned to a menu item, just set the item to that key sequence in Interface Builder and set the action of the menu item to call your method in your code, or use nil-targeted action if it's a multi-document app (in this case connect the item to the First Responder object). The event system will traverse the responder chain until it finds something that implements the method whose name matches the one you set in IB.

DeviledMoon
Oct 24, 2010, 05:06 PM
Assuming you are using Cocoa + Obj-C, if it's assigned to a menu item, just set the item to that key sequence in Interface Builder and set the action of the menu item to call your method in your code, or use nil-targeted action if it's a multi-document app (in this case connect the item to the First Responder object). The event system will traverse the responder chain until it finds something that implements the method whose name matches the one you set in IB.

so in general, i need to setup an Output/function to load what i want it to do, and link that menu item to it?