Search field menu resets
Search field menu resets
- Subject: Search field menu resets
- From: Robert Mullen <email@hidden>
- Date: Tue, 11 Nov 2008 12:29:46 -0800
I have a controller in which I setup a menu for a search field in a
toolbar. The search field is set to return the whole search string. I
have a procedure that looks basically like this:
-(void)setupSearchMenu
{
NSMenu *cellMenu = [[[NSMenu alloc] initWithTitle:@"Search Menu"]
autorelease];
NSMenuItem *item;
item = [[[NSMenuItem alloc] initWithTitle:@"Item 1"
action:@selector(setSearchCategoryFrom:) keyEquivalent:@""]
autorelease];
[item setTarget:self];
[item setTag:0];
[item setState:1];
[cellMenu insertItem:item atIndex:0];
item = [[[NSMenuItem alloc] initWithTitle:@"Item 2"
action:@selector(setSearchCategoryFrom:) keyEquivalent:@""]
autorelease];
[item setTarget:self];
[item setTag:1];
[item setState:0];
[cellMenu insertItem:item atIndex:1];
id searchCell = [searchField cell];
[searchCell setSearchMenuTemplate:cellMenu];
}
The procedure is fired only when the view in question becomes visible
by user action (I have verified this with NSLog statements.) After
this initialization takes place I flip check boxes to indicate what
search mode a user is in as they make selections from the menu. This
state is maintained right up to the point where enter is hit or the X
in the search field is clicked at which point the menu reverts back to
its initial state. This throws it out of sync with what the user has
selected and I don't think the menu should change just because one
search instance is triggered. Changing is the users decision. Is this
behavior normal or am I doing something wrong in the construction of
this menu or configuration of the search field?
TIA.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden