Application output

Discussion in 'Mac Programming' started by shollen, Feb 15, 2011.

  1. shollen macrumors newbie

    Joined:
    Feb 15, 2011
    #1
    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
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    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
     
  3. shollen, Feb 15, 2011
    Last edited: Feb 15, 2011

    shollen thread starter macrumors newbie

    Joined:
    Feb 15, 2011
    #3
    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.
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Then make it editable, append your text and make it uneditable again.
     
  5. shollen thread starter macrumors newbie

    Joined:
    Feb 15, 2011
    #5
    I thought about that, but I also thought there had to be a better, more elegant way. It needs to handle constant input.
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    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.
     
  7. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #7
    This. Editable just refers to whether the text view can be manipulated by the user. Its text can always be modified through code.
     
  8. shollen thread starter macrumors newbie

    Joined:
    Feb 15, 2011
    #8
    Haven't had success with insertText.
     
  9. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #9
    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

     
  10. shollen thread starter macrumors newbie

    Joined:
    Feb 15, 2011
    #10
    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.
     

Share This Page