So... The NSTextView and insertText combination worked out somewhat ok but I don't' think it is the final answer. First, my understanding is that insertText is really only meant for user input and not background 'system' input to a NXTextStorage object. I'm not sure why but that's fine so I'll avoid it. There are other options. I did find the beginEdit and endEdit methods and it works pretty much about the same way though I have some more work to do on some detail delegate methods.
The part that doesn't work so well is getting the NSScrollView in the window to update on demand. I do the beginEdit and endEdit stuff and am able to update the NSTextStorage object properly. I can do this multiple times in the same method (a test button on the window containing the scroll view). I can tell that because print-object in debug shows me what I'm expecting at the right times. However, I'd like to be able to show an updated NSScrollView multiple times during the court of the windowDidLoad method. The scroll view updates properly when the button push method ends.
Here is some sample code. I do mix insertText and the begin/end edit methods in here but it was more of a test thing than any code I would use for real....
(IBAction)FinishButtonPush:(id)sender {
NSString *teststring;
teststring = [NSString stringWithString: @"show"];
[RunResultWindowTextView setString:teststring];
teststring = [NSString stringWithString: @"show show"];
[RunResultWindowTextView setString:teststring];
teststring = [NSString stringWithString: @"show show show show"];
[RunResultWindowTextView setString:teststring];
[RunResultWindowTextView insertText:@"123"];
NSTextStorage *tempTextStorage;
tempTextStorage = [RunResultWindowTextView textStorage];
[tempTextStorage beginEditing];
[tempTextStorage replaceCharactersInRange:NSMakeRange(5,13)
withString:@"Hello to you!"];
[tempTextStorage endEditing];
[tempTextStorage beginEditing];
[tempTextStorage replaceCharactersInRange:NSMakeRange(10,13)
withString:@"second change"];
[tempTextStorage endEditing];
[RunResultWindowTextView insertText:@"xxx123"];
[RunResultWindowTextView insertText:@"xxx123567"];
}
Even though the NSTextStorage object is updated properly, the scroll view only updates when the method completes. My understanding is that processEdit is called automatically during endEdit. I added processEdit in there just to see and all I got was either abends or no change depending on where I put the command.
This got deleted and I'm not sure why. If you're going to gong the post, please let me know why you did so. Can't improve my post unless I have an idea what was wrong with it....