• 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: Scott Anguish <email@hidden>
  • Date: Mon, 22 Dec 2003 01:06:33 -0500

the responder doesn't validate the menu item

http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/ObjC_classic/Protocols/NSMenuValidation.html#// apple_ref/occ/cat/NSMenuValidation


On Dec 22, 2003, at 12:02 AM, Aaron Patterson wrote:

I've been trying to add a custom menu to my NSSearchField. I was able to get
the menu to show up, with my "Hello World" text when I run the application.
However, for some reason, I can't select the menu item. It just appears
greyed out. Can someone provide me with any insight? Thanks!

Here is a snippet of code I have so far:

- (IBAction)search:(id)sender {
NSLog(@"Search: %@", [sender stringValue]);
}

- (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];
}

- testSelector:(id)sender {
NSLog(@"Selected Hello World");
return self;
}

--Aaron
_______________________________________________
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.
_______________________________________________
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.

References: 
 >NSSearchField menu question (From: Aaron Patterson <email@hidden>)

  • Prev by Date: Getting started with Cocoa programming
  • Next by Date: Splash screen code
  • Previous by thread: NSSearchField menu question
  • Next by thread: Re: NSSearchField menu question
  • Index(es):
    • Date
    • Thread