Re: More NSSearchField menu questions (checkmarks)
Re: More NSSearchField menu questions (checkmarks)
- Subject: Re: More NSSearchField menu questions (checkmarks)
- From: Tom <email@hidden>
- Date: Mon, 19 Jan 2004 20:29:36 -0600
Hello,
I tried to implement a search field with menu for 2 different types of
searches (search by name, search by ID). It works fine with sample code
provided in documentation with one exception: I cannot set checkmarks
for menu items like it is done in Mail.app search. Andrew's answer
below partially explains why it may happen: menu is rebuilt dynamically
for recent searches (even though I am not trying to do recent
searches). I tried the following in my searchTypeChanged selector:
[snip]
[sender setState:NSOnState];
[theOtherItem setState:NSOffState];
[searchCell setSearchMenuTemplate:searchMenu];
But still it does not work. Both menu items are unchecked.
Anyone seen a working example of a search field with search type menu
and checkmarks? Even when you look at Xcode "Developer Documentation"
window you will see that the search field has 2 search options but
currently active option is displayed below the search field and never
checkmarked in the menu. I believe it is a bug in NSSearchField
implementation and I wonder if anyone filed a bug report on this.
Thanks,
Tom
Abracode
On Wed, 7 Jan 2004, Andrew Platzer wrote:
On Jan 1, 2004, at 3:23 PM, Aaron Patterson wrote:
> I've made my search menu work, /mostly/. It displays the menu, and I
> can select
> an item, and have a check mark displayed next to it.
>
> The problem I'm having is that if I check an item in the list, then
> type
> something in the search field, and hit the "return" key, my menu goes
> back to
> the way the menu was set up when the "setSearchMenuTemplate" call was
> made.
>
> When I run the sample code I've included, I can check the "Hello
> World" field,
> then type stuff in the search field, and hit the return key. Once
> I've hit
> return, if I examine the menu, "Hello World" is no longer checked. I
> would
> greatly appreciate any insight someone might have. Thanks!
The menu is being reconstructed from the template menu so the call to
-setState: is lost the next time the menu changes (in this case to add
the new recents item.)
Instead change the menu item state in your template menu and call
-setSearchMenuTemplate: again.
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.