views:

73

answers:

1

Hi,

I have an NSTextView that contains data for the user to edit, but I want to surround it with a header and footer of non-editable data to give the user an idea of context.

I don't think an NSTextView can handle the concept of mixed editable/non-editable data, so I've come up with a few ideas.

a) Use text attachments with a custom cell to draw the header and footers.

b) Have 3 NSTextViews within the NSScrollView.

c) Use attributes to determine what cannot be edited,and use the delegate methods to prevent editing, this is probably my favourite, as it's probably the least intrusive.

Am I missing anything, any better ideas?

Cheers

MT

+2  A: 

The NSTextView delegate method -textView:shouldChangeTextInRange:replacementString: will let you do this. You can "just say NO" to change. ;-)

Joshua Nozzi
The 'range' of the footer could change depending on the edits the user makes, so I guess I could use custom attributes to keep track.I think this is sounding like the best approach so far...Thanks for the comments.
MT
That's a big part of what custom attributes are for. :-)
Joshua Nozzi