Re: Why does IB insist on putting NSTextView in an NSScrollView
Re: Why does IB insist on putting NSTextView in an NSScrollView
- Subject: Re: Why does IB insist on putting NSTextView in an NSScrollView
- From: Jerry Krinock <email@hidden>
- Date: Tue, 19 Jan 2010 19:31:13 -0800
On 2010 Jan 19, at 08:27, lbland wrote:
> On Jan 19, 2010, at 10:37 AM, Ross Carter wrote:
>
>> Not odd at all. There are several valid reasons for wanting a NSTextView not to be inside a NSScrollView. Any page-based view system does this (i.e., > 1 text view, all enclosed in the same scroll view). The Text System Architecture reference document illustrates some of these configurations. What is odd is that IB cannot build the configurations illustrated in the reference doc.
>
> Can you not just drag out a Custom View and assign its class to NSTextView or anything else? - especially your own subclass of NSTextView.
Looked like a good idea, so I tried it. But then I realized that the Inspector will not show any of its attributes, size attributes, or bindings beyond the few that are defined by NSView. That's no fun.
> P.S. - did you notice how you can drag out a scroll view, ungroup it (un-embed) and have a NSTextView? You might also notice that such a view does not move around very well, so it seems like an IB bug.
Yes. See my second post in this thread. "not move around very well" is an understatement.
****
OK, enough said. This is now Apple Bug ID# 7559528
Summary: It is not possible in Interface Builder to add an NSTextView into a nib unless it is embedded in an NSScrollView. Also, if you Unembed an NSTextView from its NSScrollView, the resulting NSTextView is immobile.
Steps to Reproduce:
1. In building an application, have a requirement for an NSTextView not embedded in an NSScrollView. This can happen, for example, if you need to precisely predict the layout of a text field. You can do this with NSLayoutManager for an NSTextView, but not for an NSTextField because the NSTypesetterBehavior is not reliably available. So, you need an NSTextView, and not an NSTextField. For another example, any page-based view system requires multiple text views all enclosed in the same scroll view). The Text System Architecture reference document illustrates some of these configurations.
2. Look in Interface Builder's Library for a NSTextView not embedded in an NSScrollView.
Expected Results:
There should be one.
Actual Results:
There is none to be found.
Notes: Possible workarounds:
1. Create NSTextView in code. This works.
2. Use NSTextView in NSScrollView and turn off the scrollers. This works, but is kind of silly because now i n your code if you want to access the frame of the NSTextView you must instead access the frame of the enclosing scroll view.
3. . Use NSTextView in NSScrollView and unembed the text view. This does not work. After you Unembed Objects, the resulting NSTextView is immobile. Select it, show Inspector, tab to "Size", and you'll see that all four coordinates x, y, w and h are disabled, both "Bounds" and "Frame". And the numbers in there are slightly different than what the scroll view's were, by a few pixels. So you can't put it exactly where you need it. I tried twice to reverse-engineer it, setting the scroll view frame to be slightly different than where I want the text view, but couldn't guess the magic numbers.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden