Re: Multiple NSTextView in an NSScrollView -- if possible
Re: Multiple NSTextView in an NSScrollView -- if possible
- Subject: Re: Multiple NSTextView in an NSScrollView -- if possible
- From: Peter Horn <email@hidden>
- Date: Sat, 2 Feb 2002 16:15:11 +0100
Hi!
I'm just a dumb newbie, therefore I need to ask again:
I'm trying to write some kind of a special terminal app to
control a command-line tool. What I want to do is get an user
input, send it to the commandline tool and then write the
'result' to a ScrollView. What's particular is that I want an
individual NSTextView for each of the results, such that I can
control editable/selectable individually for each output.
Here's a suggestion: use a single text view, and control
editability and selectability with the delegate's
textView:shouldChangeTextInRange:replacementString: and
textView:willChangeSelectionFromCharacterRange:toCharacterRange:
methods. This gives you more or less complete control over
editing and selection change.
I thought about something like this, but I don't quite see
where/when to call
textView:shouldChangeTextInRange:replacementString: -- do I have to
derivate NSTextView? I tried to receive
NSTextViewDidChangeSelectionNotification and to disable/enable
editable depending on the selections position -- sadly this didn't
suffice.
Peter