highlighting menus in the menu bar on Leopard
highlighting menus in the menu bar on Leopard
- Subject: highlighting menus in the menu bar on Leopard
- From: Martin Wierschin <email@hidden>
- Date: Thu, 1 Nov 2007 21:40:00 -0700
Hi everyone,
Our application supports multi-character keyboard shortcuts. Once we
detect that the user has completed such a shortcut we dispatch the
action assigned to the NSMenuItem as appropriate. This all still
works just fine, except for one detail: the top-level menu that
encompasses the activated item no longer highlights itself so the
user has some visual feedback on which item was activated.
Despite using NSMenu's "performActionForItemAtIndex:" we always had
to do this highlighting manually, using the following code, which
fails on Leopard:
@implementation NSMenu (Additions)
- (void) highlightInMenuBar
{
MenuRef ref = _NSGetCarbonMenu( self );
MenuID menuID = (NULL == ref) ? 0 : GetMenuID( ref );
HiliteMenu( menuID );
}
@end
I know that "_NSGetCarbonMenu" is an undocumented private API, but
actually that's not what fails on 10.5, it's the "GetMenuID" call
that always returns zero. Does anyone know any other way to
accomplish this highlighting?
Thanks in advance,
~Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden