Skip navigation.
 
mlRe: Re: Re: NSSearchField Categories Menu (bug?!)
FROM : malcom
DATE : Wed Jul 19 21:07:12 2006

Just solved.
I need to reset the template menu:

- (IBAction) menu_selectNewFilter:(id) sender {
   NSMenu* searchMenu = [searchField searchMenuTemplate];
    int    tag        = [sender tag];

   [[searchMenu itemWithTag:selectedFilter] setState:NSOffState];
   [[searchMenu itemWithTag:tag] setState:NSOnState];
    [[searchField cell] setSearchMenuTemplate:searchMenu];

       selectedFilter = tag;
}


On 7/19/06, malcom <malcom.<email_removed>> wrote:
> If you take a look to the code you will can see that the previous
> selected menu item (tag) will be turned off without scanning all the
> items. Unfortunatly NSOffSttate seems to not work because the
> checkmark still in it (but the state in fact is 0....). That's very
> strange.
>
> On 7/19/06, Adam Knight <<email_removed>> wrote:
> > Multiple menu items can be on or off at the same time.  Think of it
> > more like a checkbox than a radio button.  So if you want them to
> > turn off, you'll need to scan the menu first and turn every item off,
> > then turn your one item on.
> >
> > When I made custom search categories in Notae, I instead opted to
> > simply set the placeholder text of the search field to the title of
> > the selected menu item rather than add a checkmark to the menu.  It's
> > easier, and when the user has moved on to another area and is coming
> > back to search, it's a quick reminder of what it's set to without
> > needing to pull the menu down.
> > --
> > Adam Knight
> > "Every man is guilty of all the good he didn't do."  -- Voltaire
> >
> >
> >
> > On Jul 19, 2006, at 12:30 PM, malcom wrote:
> >
> > > Hi list,
> > > I would to add a categories menu (ex: search for Subject, Body or ...)
> > > in my NSSearchField. I've successfully set the menu but there is a
> > > problem if I try to set a menuitem to state:NSOffState.
> > > When I select a menu it should be to turn off the previous selected
> > > category. This is the code:
> > >
> > > - (IBAction) menu_selectNewFilter:(id) sender {
> > >
> > >      NSMenuItem *m = [searchMenu itemWithTag: selectedFilter];
> > >      [m setState: NSOffState];
> > >      NSLog(@"Disabled %@ %d",[m title],[m tag]);
> > >
> > >      NSLog(@"Activate %@ %d",[sender title],[sender tag]);
> > >      [sender setState: NSOnState];
> > >
> > >      selectedFilter = [sender tag];
> > > }
> > >
> > > It works for ONState but the previous item state will never change
> > > (I've also tried to take a look at the debugger and, in fact the state
> > > of NSOffState menuitem is 0...but the checkmark icon still here!).
> > > Is there a problem with this class or is it a problem of mine?
> > > _______________________________________________
> > > Do not post admin requests to the list. They will be ignored.
> > > Cocoa-dev mailing list      (<email_removed>)
> > > Help/Unsubscribe/Update your Subscription:
> > > http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
> > >
> > > This email sent to <email_removed>
> > >
> >
> >
>
>
> --
> www.malcom-mac.com - indipendent software developer
> mail: malcom.<email_removed>
>



--
www.malcom-mac.com - indipendent software developer
mail: malcom.<email_removed>

Related mailsAuthorDate
mlNSSearchField Categories Menu (bug?!) malcom Jul 19, 19:30
mlRe: NSSearchField Categories Menu (bug?!) Adam Knight Jul 19, 19:37
mlRe: Re: NSSearchField Categories Menu (bug?!) malcom Jul 19, 19:40
mlRe: Re: Re: NSSearchField Categories Menu (bug?!) malcom Jul 19, 21:07
mlRe: NSSearchField Categories Menu (bug?!) Matt Neuburg Jul 19, 21:36