Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shollen

macrumors newbie
Original poster
Feb 15, 2011
5
0
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
 
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
 
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

Well, I'd like to build the output window into the client.

I think I mis-described my project. I don't need to read the server data stream. The game provides webservices for issuing commands and receiving output. I just need an uneditable view to display the output in. I tried an NSTextView, but if you make it uneditable you can't insert text into it.
 
Last edited:
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.
 
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.

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

...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

No, I didn't. I certainly should have. My bad. I'll research more carefully next time.

I really appreciate your help. textStorage is exactly what I was looking for.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.