tags:

views:

29

answers:

1

I'm trying to handle events related to clicking on or pressing enter on a menu item using the Carbon API in OSX (Cocoa is not an option).

I know about EventTypeSpec and kEventClassMenu and i've dug through the header files looking for the relevant kind constant to use, but i'm still a bit confused as to how I respond to the selection of a menu item. Do I need to handle a key down or mouse down event at the same time as a kEventMenuTargetItem? Do I need to handle kEventMenuMatchKey separately for the enter key?

A: 

I'm an idiot.. Events caused by menu items are handled by class command. So:

eventTypes[0].eventClass = kEventClassCommand;
eventTypes[0].eventKind = kEventCommandProcess;

will handle menu events.

Paul Johnson