Re: Customizing NSSearchField menu
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.