I am familiar with the NSControlTextDidBeginEditingNotification notification, but this notification is insufficient for my needs because it is only sent after the user actually changes the text and not when the user clicks in the field and it actually allowed to change the text.

The reason this is important is that I have a text field which is part of an item in a NSCollectionView. I need to allow the user to to click and edit the text, but I also need the NSCollectionView to be able to mark the item as selected if the user does so. At the moment, if the user clicks in the field to edit the text, the NSCollectionView's selected items are not changed.

One possible solution I am considering, is sending a notification that my collection view is observing when the user is actually allowed to change the text. When the NSCollectionView responds to the notification, it would mark the item as selected.

The question is: Where should the code to send the notification be placed?

One possible implementation is to subclass the NSTextField and override the becomeFirstResponder method which I think is only called when the user is actually allowed to being editing the text. I am disturbed by the fact that immediately after becomeFirstResponder is called, resignFirstResponder is called. Although, the fact that resignFirstResponder is probably not of any concern since there would be no reason to change the selection.

Any thoughts or comments?

(I'm kinda hoping there is an easier or standard way to do this which I have missed in the documentation...)
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to