• 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: Customizing NSSearchField menu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Customizing NSSearchField menu


  • Subject: Re: Customizing NSSearchField menu
  • From: Andrew Platzer <email@hidden>
  • Date: Tue, 10 Feb 2004 14:27:13 -0800

On Feb 10, 2004, at 12:56 PM, Jeremy Dronfield wrote:
Is there a way to intercept the point at which a search field updates its pull-down menu? I have a search field with a custom menu template (built in IB) to add the following search parameters: Search in Volume A; Search in Volume B; Search in All Volumes.

Instead of changing the sender, just update your search menu template and set it and the next time it's built, it will get the new state. Do it in your action method since that's as good a place as any to change it. By calling setSearchMenuTemplate, you notify the search field the menu has changed. Please file a bug about it so we can perhaps make the documentation clearer on how to do this.

- (IBAction)setSearchParameter:(id)sender
{
NSMenu* searchMenu = [[searchField cell] searchMenuTemplate];
int tag = [sender tag];

[[searchMenu itemWithTag:lastSearchParam] setState:NSOffState];
[[searchMenu itemWithTag:tag] setState:NSOnState];
[[searchField cell] setSearchMenuTemplate:searchMenu];

[self setLastSearchParam:tag];
}

Andrew
_______________________________
Andrew Platzer
Application Frameworks
Apple Computer, Inc.
_______________________________________________
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: Customizing NSSearchField menu
      • From: Jeremy Dronfield <email@hidden>
References: 
 >Customizing NSSearchField menu (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Sneaky Key-Value Observing
  • Next by Date: How to enable NSSearchField menu items?
  • Previous by thread: Customizing NSSearchField menu
  • Next by thread: Re: Customizing NSSearchField menu
  • Index(es):
    • Date
    • Thread