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