Re: Creating a console view

2010-03-16 Thread Rick Mann
Thanks, Martin. I ended up doing this: NSAttributedString* as = [[NSAttributedString alloc] initWithString: s attributes: attrs]; NSTextStorage* text = self.output.textStorage; [text beginEditing]; [text appendAttributedString: as]; [text endEditing];

Re: Creating a console view

2010-03-16 Thread Martin Hewitson
Hi Rick, I assume 'output' is your NSTextView. Right? Firstly, you can append text more easily by doing: 1) [output insertText:mystring]; or 2) [[output textStorage] appendAttributedString:myAttributedString]; To get changes to show up, try [output didChangeText]; You might not need that

Re: Creating a console view

2010-03-16 Thread Rick Mann
On Mar 16, 2010, at 19:24:17, Jens Alfke wrote: > > On Mar 16, 2010, at 7:13 PM, Rick Mann wrote: > >> There's no warning because there's no difference between >> NSString* existingText = self.output.string; >> and >> NSString* existingText = [self.output string]; > > Actually I misr

Re: Creating a console view

2010-03-16 Thread Jens Alfke
On Mar 16, 2010, at 7:13 PM, Rick Mann wrote: > There's no warning because there's no difference between > NSString* existingText = self.output.string; > and > NSString* existingText = [self.output string]; Actually I misread your code and thought you were calling -replaceCharacters

Re: Creating a console view

2010-03-16 Thread Rick Mann
On Mar 16, 2010, at 18:55:02, Jens Alfke wrote: > > On Mar 16, 2010, at 6:19 PM, Rick Mann wrote: > >> I'm currently using an NSTextView, and calling the following to append text: >> >> NSString* existingText = self.output.string; >> NSRange r = NSMakeRange(existingText.length, 0); >> [se

Re: Creating a console view

2010-03-16 Thread Jens Alfke
On Mar 16, 2010, at 6:19 PM, Rick Mann wrote: > I'm currently using an NSTextView, and calling the following to append text: > >NSString* existingText = self.output.string; >NSRange r = NSMakeRange(existingText.length, 0); >[self.output replaceCharactersInRange: r withString: s]; Th

Creating a console view

2010-03-16 Thread Rick Mann
Some time ago, I created a little console in my app, displaying characters received on a serial port. For the life of me, I can't find that app to see how I did it. I'm currently using an NSTextView, and calling the following to append text: NSString* existingText = self.output.string;