Re: AddressBook-like TextFields?
Re: AddressBook-like TextFields?
- Subject: Re: AddressBook-like TextFields?
- From: Alexandre Aybes <email@hidden>
- Date: Mon, 23 May 2005 11:06:44 -0700
Not sure if this is what you are looking for, but this has worked for
me to check if a particular text field or text view has focus:
if ([myTextFieldOrTextView currentEditor] ==
[[myTextFieldOrTextView window] firstResponder])
One additional note though, if your text views overlap or your shadow
overlaps text views you might encounter some drawing glitches, 2
views are not supposed to overlap (in which case you could do the
drawing of the outline and the shadow in an overlay window).
Alex.
On May 23, 2005, at 10:29 AM, Justin Fagnani wrote:
On May 22, 2005, at 8:27 AM, Ryan Stevens wrote:
I'd start here; http://www.cocoadev.com/index.pl?CCDGrowingTextField
Thanks, but actually the growing text field effect is the thing I'm
least concerned about. I mainly want to get the shadowing and the
labeling, and the labeling part is easy.
Anyone else have any suggestions for my firstResponder situation?
I've tried some things with [NSView focusView], but that hasn't
yielded anything either.
-Justin
On May 21, 2005, at 12:56 PM, Justin Fagnani wrote:
So I've investigated and played around some more and determined
that as cool as the Address Book trick of subclassing NSTextView
and grabbing the selected range is, it won't work for me. The
reason is that I'm using CoreData and bindings and I want to set
everything up in IB.
So what I'm trying to do now is have a view that basically draws
custom focus rings along with TextField subclasses that display
their name in grey when there's no data.
I'm having a hell of a time getting anywhere though. I can iterate
through the subviews in drawRect and draw a rectangle around them,
but I can't figure out which one has the focus. I know the proper
terminology is firstResponder, but that's not really true either,
because as the knowledgeable folk here know, the firstResponder
when a TextField is selected is the windows FieldEditor. I can't
seem to find out which cell (it is individual NSTextCells that the
FieldEditor works for, right?) the FieldEditor is attached to. The
frame of the field editor is in the coordinate system of that
view, so that does me no good.
I've seen a few threads in the archives about this, but couldn't
come up with a clear answer.
Also, please correct me if I'm wrong about thinking about this as
if I want to draw a custom focusRing. I say it that way because it
seems like the focusRing is drawn by the parent view since it's
actually outside the edge of the view.
thanks,
-Justin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
_______________________________________________
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