• 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 question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSearchField menu question


  • Subject: Re: NSSearchField menu question
  • From: mmalcolm crawford <email@hidden>
  • Date: Mon, 22 Dec 2003 03:11:24 -0800

On Dec 21, 2003, at 9:02 PM, Aaron Patterson wrote:

- (void)awakeFromNib {
NSMenu * cellMenu = [[NSMenu alloc] initWithTitle:@"Search Menu"];
NSMenuItem *item1;
id searchCell = [searchField cell];

item1 = [[NSMenuItem alloc] initWithTitle:@"Hello World!"
action:@selector(testSelector:) keyEquivalent:@""];
[cellMenu insertItem:item1 atIndex:0];
[item1 release];
[searchCell setSearchMenuTemplate:cellMenu];
}

Scott already pointed out "the responder doesn't validate the menu item".

You might also need:
[item1 setTarget:self];
and a final
[cellMenu release];

For an example, see:
<http://homepage.mac.com/mmalc/CocoaExamples/SearchField.zip>

mmalc
_______________________________________________
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 question
      • From: Aaron Patterson <email@hidden>
References: 
 >NSSearchField menu question (From: Aaron Patterson <email@hidden>)

  • Prev by Date: Re: What is the equivallent of CFMessagePortRef in Cocoa?
  • Next by Date: True multiuser?
  • Previous by thread: Re: NSSearchField menu question
  • Next by thread: Re: NSSearchField menu question
  • Index(es):
    • Date
    • Thread