NSControlTextDidChangeNotification fires only once upon setting delegate
NSControlTextDidChangeNotification fires only once upon setting delegate
- Subject: NSControlTextDidChangeNotification fires only once upon setting delegate
- From: email@hidden
- Date: Fri, 28 Sep 2007 19:01:44 -0700
Hello list.
I'm trying to implement a Safari-style address field with completion.
I'm using an ImageAndTextCell in an NSMatrix, and trying to leverage
the built-in completion by doing the following in my controller code:
* Observe NSControlTextDidChangeNotification notifications from the
NSMatrix.
* When the NSControlTextDidChangeNotification arrives, get the field
editor for the ImageAndTextCell, and set the field editor's delegate
to my controller, so that I get
textView:completions:forPartialWordRange:indexOfSelectedItem:
delegate calls.
* In textView:completions:forPartialWordRange:indexOfSelectedItem:, I
fetch the matching items and return them.
This works as expected, but only the first time, that is, when I type
the first character in the field. It fills in the field and selects
the part following the keyboard input, and displays the pull-down
list with that item selected. However, I do not get
NSControlTextDidChangeNotification for subsequent key presses, hence
no completion and no pull-down.
If I comment out the body of the NSControlTextDidChangeNotification
handler and replace it with an NSLog, I see it is called as expected
for all characters. Setting the delegate seems to be enough to cause
the problem.
Am I doing something wrong in my delegate that keeps subsequent
notifications from firing? I have tried google searches and read the
NSTextView class documentation, and I'm stuck.
Is this the wrong approach? Any suggestions are welcome.
Thank you.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden