• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView storage problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextView storage problem


  • Subject: Re: NSTextView storage problem
  • From: Fred Klein <email@hidden>
  • Date: Sun, 27 Jul 2003 14:27:30 +0200
  • Resent-date: Sun, 27 Jul 2003 14:30:36 +0200
  • Resent-from: Fred Klein <email@hidden>
  • Resent-message-id: <email@hidden>
  • Resent-to: email@hidden

On Sunday, Jul 27, 2003, at 02:33 Europe/Zurich, LANCE GREENWOOD wrote:

- (IBAction)updateNSTextFieldAction:(id)sender
{
value = [textViewOutlet string];
[textFieldOutlet setStringValue:value];
}
...
Now why doesn't value have anything in it? Or what is the best way to store the information
in the NSTextView. I don't need any formatting information.

Lance,
I had a look to the doc for NSText string:
"Returns the characters of the receiver's text. For performance reasons, this method returns the current backing store of the text object. If you want to maintain a snapshot of this as you manipulate the text storage, you should make a copy of the appropriate substring."

So, I suggest you make a copy of the string in updateNSTextFieldAction with, for instance, NSString stringWithString:.

value = [NSString stringWithString:[textViewOutlet string]];

NB: I am brand new to Cocoa. Please forgive me if this is all wrong but it's a good way for me to learn too.

Fred
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: A4 and NSMakeRect
  • Next by Date: Building the OmniFrameworks
  • Previous by thread: Re: NSTextView storage problem
  • Next by thread: window deactivated by launch
  • Index(es):
    • Date
    • Thread