Re: Subclass of TextView in ScrollView
Re: Subclass of TextView in ScrollView
- Subject: Re: Subclass of TextView in ScrollView
- From: Vince DeMarco <email@hidden>
- Date: Thu, 13 Dec 2001 21:45:34 -0800
On Thursday, December 13, 2001, at 02:32 pm, Michael Peirce wrote:
On Thursday, December 13, 2001, at 02:13 PM, Gerriet M. Denkmann wrote:
I have an document based app with a window with a ScrollView with a
TextView.
But now I would like to have a subclass MyTextView inside the ScrollView.
Is there a way to do this inside IB?
Or do I have to replace the TextView with MyTextView progrmmatically (e.
g. in windowControllerDidLoadNib:) ?
With IB viewing your ___.nib window click on the "Classes" tab. Then
navigate to the NSTextView item and select it.
Look up in the "Classes" menu and you should see the first item called
"Subclass NSTextView". It will create one called MyTextView (you can
change the name by double clicking on the text).
This subclass will have the same Actions and Outlets that NSTextView has,
and you can add your own.
Now drag out a CustomView and in it's Attributes info panel you can
select your MyTextView there to set it as the class for that view.
When the nib is used in your program, your custom view will be of type
MyTextView.
Oh, I see you were asking about using MyTextView inside a scroll view. It
seems like you should be able to select the NSTextView (by doubclicking
after dragging out a NSTextView embedded in an NSScrollView from the
palette) and view the "Custom Class" in the info panel, but it says "Not
Applicable" in this case.
That's odd since when I click on, say, an NSImage UI element, I get a
list of all the NSImage subclasses I've created and can select one of
them for this UI element.
Even for other views embedded in an NSScroller - I tried this on an
NSOutline view in a NSScroller I dragged over from the palette and it
works as I'd expect.
Is this a bug?
Yes its a bug but its due to a limitation in how NSTextView archives
itself.
vince