Re: event/notification for focus?
Re: event/notification for focus?
- Subject: Re: event/notification for focus?
- From: Ricky Sharp <email@hidden>
- Date: Wed, 06 Apr 2005 14:58:56 -0500
On Wednesday, April 06, 2005, at 01:58PM, Luc Vandal <email@hidden> wrote:
>is there any event/notification for when a control gains focus? I did
>search in the documentation and they mention that you can get notified
>when your control has focus but I can't seem to find any code to do it
>(I know how to register for a notification, but I don't know which
>class has that notification nor the notification name)!
I don't think any such notification exists. The documentation may have been pointing you to NSViewFocusDidChangeNotification. But, 'focus' in that context is very different than "being first responder"; it's to let you know that the view that had focus (see lockFocus and friends) has changed.
Definitely search the archives. There was a couple of threads about this. Most of the suggestions made were to subclass the widgets and provide an override for becomeFirstResponder. However, that will get tricky with text fields since when a text field is being edited, you're actually working with an instance of the field editor. It's possible though to specify that the field editor use your override. However, being that the field editor is a single instance, I can imagine that causing grief. i.e. if you have three edit fields, then finding out which one has the focus is probably not possible since the single instance of the field editor has the focus.
>Also, is there some quick reference people use to quickly find stuff
>like that? I dunno if it's my PC dev background but I always have a
>hard time to find out about pretty much anything in the documentation
>for Cocoa. :)
I use Xcode first, then list archives, then google. It can get very tricky though for certain terms. As shown above, focus has two different meanings.
--
Rick Sharp
Instant Interactive(tm)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden