Re: Send action when textDidChange
Re: Send action when textDidChange
- Subject: Re: Send action when textDidChange
- From: Eric Peyton <email@hidden>
- Date: Tue, 26 Jun 2001 07:52:37 -0500
All of the delegate and observer messages handle this gracefully by
containing a sender (in the case of delegate messages) or control
(in the case of the message you are looking at).
In this case, in the NSControl header you see something like this ...
// userInfo keys:
APPKIT_EXTERN NSString *NSControlTextDidChangeNotification; // @"NSFieldEditor"
In the userInfo dictionary returned in the NSNotification there is
a key called NSFieldEditor and there is an object corresponding to
the object in your code that is sending the message.
In your case, you want to test if that object is the one that you
want didChange notifications and ignore the message completely if
it comes from the other textFields.
Eric
On Monday, June 25, 2001, at 11:36 PM, 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.
Ivan
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev