Re: Newbie - which NSTextField is the cursor in?
Re: Newbie - which NSTextField is the cursor in?
- Subject: Re: Newbie - which NSTextField is the cursor in?
- From: Thomas Lachand-Robert <email@hidden>
- Date: Mon, 18 Mar 2002 19:49:31 +0100
Le lundi 18 mars 2002, ` 07:11 , email@hidden a icrit :
[window firstResponder] should be correct in theory. However, I
think it might return the field editor for the textfield, not the
textfield itself. I'm not sure offhand how to get from the field
editor back to the original textfield.
You know whether there is a text field edited currently by checking if
the first responder is a NSTextView and responds YES to isFieldEditor.
If so, its delegate is the currently edited NSTextField.
Interesting. Sounds generally reliable, although the -isFieldEditor
method sounds like it doesn't actually have anything directly to do with
whether the NSText object is being used as a field editor; its direct
semantic meaning has to do with the way tab, shift-tab, and enter behave,
and non-field-editor NSText objects may still return YES for
-isFieldEditor, as I read the doc. Furthermore, I can't find anything in
the doc about the field editor's delegate; is this a documented behavior
that one may rely on, or does it just happen to be the case in the
current implementation?
If one needs to get from the field editor back to the editing textfield,
this sounds like the way, as the APIs currently stand, but it would be
nice for there to be a clearer way, or at least clearer doc. In any case,
I don't think it is necessary to solve the problem the original poster
had, so given these concerns, perhaps other solutions might be better...
Yes it is documented... somewhere. I found it two days ago (after hours of
search), and now I can't find it again, so it's really buried somewhere
(nothing unusual :->)
Anyway it works. I agree that -isFieldEditor is a strange thing; the
description does not correspond well to the name...
Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.