• 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: Jeremy Dronfield <email@hidden>
  • Date: Wed, 11 Feb 2004 10:40:45 +0000

On 10 Feb 2004, at 10:27 pm, Andrew Platzer wrote:

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

Thanks. That solves my problem. You're right - the documentation could be a little clearer on this. Bug duly filed.

-Jeremy

========================================
email@hidden

theLocustFarm.net:
- fractious fiction at http://freespace.virgin.net/jeremy.dronfield
========================================
_______________________________________________
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: 
 >Customizing NSSearchField menu (From: Jeremy Dronfield <email@hidden>)
 >Re: Customizing NSSearchField menu (From: Andrew Platzer <email@hidden>)

  • Prev by Date: Re: Sending and receiving files to remote server through cocoa
  • Next by Date: Redrawing NSTableHeaderCells when on window activation or deactivation
  • Previous by thread: Re: Customizing NSSearchField menu
  • Next by thread: Where's the journal file on a journalled drive?
  • Index(es):
    • Date
    • Thread