Re: Send action when textDidChange
Re: Send action when textDidChange
- Subject: Re: Send action when textDidChange
- From: Carlos Weber <email@hidden>
- Date: Mon, 25 Jun 2001 21:41:15 -1000
On Monday, June 25, 2001, at 06:36 , Ivan Myrvold wrote:
>
My application have a search field and a table. When a user types
>
something in the search field, the table should update based on the
>
search value.
>
>
I solved this by adding the window controller as an observer of the
>
NSControlTextDidChangeNotification message. This works great. But the
>
window also have two other fields, and the
>
NSControlTextDidChangeNotification message is posted also when these
>
fields are edited.
>
>
To solve this side effect, it would be nice to have the text field send
>
an action when the text in its field changes. As I have understood from
>
the documentation, the default is that an action message is sent when
>
the return key is pressed.
>
>
So how do I change this? I read the docs for NSControl, NSActionCell
>
and NSCell without finding the answer to this.
What if you just registered as an observer of the
NSControlTextDidChangeNotification message for your particular search
field? The method
- (void)addObserver:(id)anObserver
selector:(SEL)aSelector
name:(NSString *)notificationName
object:(id)anObject
allows you to specify anObject as the sole source of the notifications,
or pass nil if you want to receive the notification from all sources.
Or did I misunderstand what you are trying to accomplish?