Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
applicationDockMenu: woes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

applicationDockMenu: woes



Hey all, I'm encountering some sub-optimal behavior when attempting to have a dynamic dock menu via applicationDockMenu: in my NSApplication delegate.

The following is some sample code that illustrates two display issues I'm facing when the menu is actually shown in the Dock (on OS X 10.3.4). Firstly, the separator item is not drawn as a separator, but rather as regular item that is empty (not good). The second problem is that the menu items' images are not shown at all (not a major problem, but aesthetically problematic).

Anyone know what's going on? I've considered falling down into Carbon, hoping that things might work on that level, but my attempts to do so have thus far failed.

Cheers!
Dave Watanabe


- (NSMenu*) applicationDockMenu: (id) sender;
{
/* allocate menu */
NSMenu* result = [[[NSMenu alloc] initWithTitle: @""] autorelease];
id item;

/* add first sample item */
item = [[[NSMenuItem alloc] initWithTitle: @"First Sample Item" action: @selector(whatever:) keyEquivalent: @""] autorelease];
[item setImage: [NSImage imageNamed: @"PlayList"]];
[result addItem: item];

/* add separator */
[result addItem: [NSMenuItem separatorItem]];

/* add second sample item */
item = [[[NSMenuItem alloc] initWithTitle: @"Second Sample Item" action: @selector(whatever:) keyEquivalent: @""] autorelease];
[item setImage: [NSImage imageNamed: @"PlayList"]];
[result addItem: item];

return result;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.