I'm building a client for an online text game. Which view should I use for displaying the game's streaming text output? I need to display uneditable text, ala the Mac's terminal window or the window of a telnet client.
Thanks!
-Shan
It seems like you answered your own question... the terminal seems like a reasonable place. If you're needing a "fancier" text UI, ncurses seems to be a pretty popular option.
-Lee
I tried an NSTextView, but if you make it uneditable you can't insert text into it.
Then make it editable, append your text and make it uneditable again.
I thought about that, but I also thought there had to be a better, more elegant way. It needs to handle constant input.
Well you can go through the textStorage of the text view. This is a NSMutableAttributedString so you can then get the unerlying mutableString and alter that directly. I'm pretty sure that works regardless of whether the view itself is editable.
This. Editable just refers to whether the text view can be manipulated by the user. Its text can always be modified through code.
Haven't had success with insertText.
...is generally not suitable for other purposes. Programmatic modification of the text is best done by operating on the text storage directly. Because this method pertains to the actions of the user, the text view must be editable for the insertion to work.
Did you read the documentation description for that? It's never going to work if the view is not editable. I quote from the documentation below