Re: NSSearchField Menu Enabling Troubles...
Re: NSSearchField Menu Enabling Troubles...
- Subject: Re: NSSearchField Menu Enabling Troubles...
- From: Oliver Cameron <email@hidden>
- Date: Mon, 31 May 2004 16:38:15 +0100
Thanks!
That worked great.
On 31 May 2004, at 16:23, Jeremy Dronfield wrote:
On 31 May 2004, at 2:13 pm, Oliver Cameron wrote:
- (void)setupSearchBar
{
NSMenu *cellMenu = [[[NSMenu alloc] initWithTitle:@"Search Menu"]
autorelease];
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@"PHP.Net
Manual" action:@selector(setPHP:) keyEquivalent:@""];
NSMenuItem *item2 = [[NSMenuItem alloc] initWithTitle:@"MySQL Manual"
action:@selector(setMySQL:) keyEquivalent:@""];
id searchCell = [searchBar cell];
[cellMenu insertItem:item atIndex:0];
[cellMenu insertItem:item2 atIndex:1];
[item release];
[item2 release];
[searchCell setSearchMenuTemplate:cellMenu];
}
You haven't assigned a target to your menu items. Try [item
setTarget:self] (or whatever the target should be). This isn't shown
in the Apple example you refer to because the menu items they are
illustrating are Recent Search-related. (You might want to add those
standard items to your menu as well - they are useful.)
Hope this helps. Regards,
-Jeremy
_______________________________________________
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.