• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSSearchField Menu Enabling Troubles...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSearchField Menu Enabling Troubles...


  • Subject: Re: NSSearchField Menu Enabling Troubles...
  • From: Jeremy Dronfield <email@hidden>
  • Date: Mon, 31 May 2004 16:23:34 +0100

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.


  • Follow-Ups:
    • Re: NSSearchField Menu Enabling Troubles...
      • From: Oliver Cameron <email@hidden>
References: 
 >NSSearchField Menu Enabling Troubles... (From: Oliver Cameron <email@hidden>)

  • Prev by Date: Re: Creating Dictionary Keys
  • Next by Date: Re: Code Guidelines
  • Previous by thread: NSSearchField Menu Enabling Troubles...
  • Next by thread: Re: NSSearchField Menu Enabling Troubles...
  • Index(es):
    • Date
    • Thread