Re: Search Field MenuItem Enabling
Re: Search Field MenuItem Enabling
- Subject: Re: Search Field MenuItem Enabling
- From: Philippe Mougin <email@hidden>
- Date: Mon, 5 Apr 2004 03:07:59 +0200
Seth,
I suppose you are using an NSSearchField here (?). If this is the
case, here are some info that might help:
An NSSearchField has in fact two different NSMenu objects. The template
menu and the "real" menu which is actually used on-screen. In the
current implementation, the "real" menu is generated and re-generated
at various times from the template menu.
Thus, if you modify the template menu after the real menu has been
generated, your modification will not impact the real menu immediately.
And, if you modify the real menu directly, your modification will be
overridden when the real menu is regenerated from the template menu.
In general, you should either modify (or set-up) the template menu
before the real menu is generated, or modify both the template menu and
the real menu.
Best,
Philippe Mougin
> I'm having trouble getting a menu item in my search
> field's menu to enable. I set an outlet in a controller
> to point to this specific menu item. When the search
> field is added to the toolbar, I set the target and
> action to the controller. Now from what I've read, as
> long as the target is not nil and the action is implemented,
> the menu item should be enabled, but it's always disabled.
> I originally tried setting the target/action in the nib,
> but it didn't work and then I went this route. I've stepped
> through with the debugger and when it sets the target and
> action, the menu item is definitely not nil, so I'm not sending
> messages to the middle of nowhere and thinking it's working,
> it actually isn't.
>
> Does anyone have any ideas? Is there perhaps an example
> of adding a menu item to a search field's menu somewhere?
_______________________________________________
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.