Re: Metrics for a NSTextField
Re: Metrics for a NSTextField
- Subject: Re: Metrics for a NSTextField
- From: Martin Wierschin <email@hidden>
- Date: Thu, 26 Feb 2009 13:27:48 -0800
Hi Eric,
Sizing the editor may not be the window's responsibility- it may
expect
the control to do so. What happens if you resize the NSTextView
and/or
NSTextContainer yourself as needed?
This is possible, but the documentation does not say anything about
this being necessary.
In fact, you might have to call additional methods before it is
properly
usable, eg: "setUpFieldEditorAttributes:"
Well, the documentation for setUpFieldEditorAttributes: says:
Sets up the field editor. You never invoke this method
directly; by
overriding it, however, you can customize the field editor.
I have no need to customize it...the default one it provides is
just fine.
It may say that, but you're completely bypassing the normal way the
field editor works. I think the documentation is written with the
expectation that the editor will be configured by the control.
What isn't clear how I can get a NSLayoutManager that will layout
the text in the same way as a NSTextField, but perhaps this isn't
possible because NSTextField does custom layout apart from a
NSLayoutManager.
I think you've hit upon the general problem. NSTextField wasn't
designed for what you wish it to be. I'd either upgrade to a full
NSTextView, which always has a dedicated NSLayoutManager attached, or
roll your own control whose drawing method is controlled by you.
~Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden