Skip navigation.
 
mlAuto-hiding and auto-showing an NSTextField border
FROM : Nick Zitzmann
DATE : Tue Dec 07 22:38:20 2004

OK, I've searched the archives and tried a number of things, but I
can't figure this one out...

I have an NSTextField with no border. I want the border to appear when
the text field is the first responder, and disappear when it is no
longer the first responder. How do I get it to do this?

I already tried:
1. Subclassing NSTextField & overriding -becomeFirstResponder to turn
on the border, and -resignFirstResponder to turn it back off (which
doesn't work since the text field immediately hands off first responder
status to the field editor, causing -resignFirstResponder to be called
just after -becomeFirstResponder)
2. Subclassing NSTextField & overriding -drawRect: (it isn't called
when the text field is editing)
3. Setting -controlTextDidBeginEditing: in the text field's delegate
(it is never called, although -controlTextDidEndEditing: is called)

Alternately, is there any way to override the field editor for
NSTextField to make it use a different NSTextView subclass? If so, how
do I do that?

Nick Zitzmann
<http://www.chronosnet.com/>

Related mailsAuthorDate
mlAuto-hiding and auto-showing an NSTextField border Nick Zitzmann Dec 7, 22:38
mlRe: Auto-hiding and auto-showing an NSTextField border Louis C. Sacha Dec 9, 01:25