Re: [Q] detecting when a NSTextField begins editing
Re: [Q] detecting when a NSTextField begins editing
- Subject: Re: [Q] detecting when a NSTextField begins editing
- From: Kevin Gessner <email@hidden>
- Date: Sat, 14 Feb 2009 14:57:01 +0100
Maybe you could listen for the window's delegate to receive
windowWillReturnFieldEditor:toObject: for the text field? I've no
experience with it, but the docs indicate that it should be called at
the beginning of an editing session.
HTH
-- Kevin
Kevin Gessner
http://kevingessner.com
email@hidden
On Feb 4, 2009, at 6:00 PM, Eric Gorr wrote:
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 (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
_______________________________________________
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