Re: multiline NSTextFields (solution)
Re: multiline NSTextFields (solution)
- Subject: Re: multiline NSTextFields (solution)
- From: Andreas Monitzer <email@hidden>
- Date: Tue, 25 Sep 2001 03:27:31 +0200
On Monday, September 24, 2001, at 08:37 , Brian Webster wrote:
On Monday, September 24, 2001, at 01:19 PM, Andreas Monitzer wrote:
On Monday, September 24, 2001, at 07:46 , Brian Webster wrote:
To override the custom field editor, you should implement the
windowWillReturnFieldEditor:toObject: method in your window's delegate.
Well, since I'm working inside the System Preferences app (just like the
network-setup), I can't alter the window's delegate, because that might
break something (maybe not now, but maybe in the future). Any better way
to set the field editor?
Well, a class dump of the network setup pref bundle reveals that the
NetworkController class, which inherits from NSAdminPreference,
implements that delegate method. I'm not too familiar with the system
prefs API, but perhaps it automatically sets the controller as the window'
s delegate?
No, it doesn't and there's already a delegate set, so I can't just
override it.
My solution is really ObjC-style: I've implemented a proxy object that
forwards all messages except windowWillReturnFieldEditor:toObject: to the
original delegate. windowWillReturnFieldEditor:toObject: is routed to my
special object that checks if the field should be multiline and returns
nil or the prepared NSTextView (this delegate is only set when my pane is
selected, so I don't have to care about foreign textfields).
Next step: Tab should work like in a regular textfield. I guess I have to
subclass NSTextView and override -insertTab:.
andy
--
"He was addicted to life. But we cured him"