NSTextView Problem

Discussion in 'Mac Programming' started by joshSIM, Sep 28, 2011.

  1. joshSIM macrumors newbie

    Joined:
    Sep 28, 2011
    #1
    hey, kinda new here but hope i get answers :)
    in Xcode I have a scripting bridge to Mail.app. To send a message i need an NSTextView... problem is I store the email gradually in an NSMutableDictionary and you cant store text in an NSTextView, only in an NSTextField
    please help!
    TIA
    Josh
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    The superclass of NSTextView is NSText. This has both string and setString methods to get/set the string. I don't see why you can't "store text in a NSTextView".
     
  3. foidulus macrumors 6502a

    Joined:
    Jan 15, 2007
    #3
    Wouldn't it be better if you used KVC?
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I don't see what Key-Value Coding has to do with the question posed.
     
  5. joshSIM thread starter macrumors newbie

    Joined:
    Sep 28, 2011
    #5
    when I open interface builder I click on the NSTextView and go to the value bindings but it is disabled
    ????
    Josh
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    So you can't bind the property. This makes some sense given the noted performance optimisation in the documentation for the string method. You will have to write some actual code.
     
  7. joshSIM thread starter macrumors newbie

    Joined:
    Sep 28, 2011
    #7
    Can you please give me examples?

    Could ou please give me examples of code, prehaps in a form of a controller, I am a complete noob so please help!
    TIA
    Josh
     
  8. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #8
    No. I firmly believe that providing people with "example" code simply results in that code being blindly copy/pasted and the person learns nothing. The art of programming is in the programmers ability to think about a problem, break it down and solve it. Not in copying code someone else has written.
     
  9. joshSIM thread starter macrumors newbie

    Joined:
    Sep 28, 2011
    #9
    Your right

    I would like to learn C.
    Do you know any good ebooks to start learning cocoa proggraming?
    Thanks
    Josh
    (P.S your right, sorry;))
     
  10. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #10
    Do you want to learn C or Cocoa? One is a programming language the other is a set of APIs which are mostly targeted against Objective-C which is a different language. Unfortunately I don't know of any good e-Books. The course text when we were taught C in first year at Uni was A Book on C which I found to be pretty good.
     

Share This Page