How do I use the 'Preferences' menu item ?

Monday, July 21 2003 @ 12:33 PM UTC

Contributed by: witness

MacOS X automatically adds a "Preferences" menu item, but it's always disabled, and EnableItem() seems to think the item doesn't exist in my menu???

To enable the "Preferences" menu item, use "EnableMenuCommand( NULL, kHICommandPreferences );" to enable it. EnableMenuCommand() can search your entire menu bar, even those parts of the application menu that wasn't created by you (which is actually a separate menu that's simply been inserted into your application menu). You also need to register a kEventProcessCommand Carbon Event Handler on your application's or window's event target from which you can handle menu selections.