• 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
Insert text into NSTextView/NSTextStorage does not work
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Insert text into NSTextView/NSTextStorage does not work


  • Subject: Insert text into NSTextView/NSTextStorage does not work
  • From: "Uli Gabor" <email@hidden>
  • Date: Sat, 29 Dec 2007 13:21:49 +0100

Hi

I am pretty new to cocoa and try to refill a NSTextView interface object with new text, but it just does not want to work...

I dropped the "Text View" (NSScrollView) item out of the "Cocoa"->"Views & Cells" folder onto the application.
I declared
 IBOutlet NSTextView* registers;
in my class in XCode, loaded the class into the application builder and connected an object of my class with the NSTextView part of the item I dropped onto the application (from object to item).

This seems right to me (at least it does work :D), but whatever I want to do with "registers" does not work...

As I mentioned before, my aim is to replace the whole text with a new (C-)String/char-construct (char*).

I tried
 [[registers textStorage] replaceCharactersInRange:NSMakeRange([[registers textStorage] length], 0) withString:@"Hi. Nur ein Test "];
as a little test. Does not work.
A little bit shorter
 [[registers textStorage] replaceCharactersInRange:NSMakeRange(0, 0) withString:@"Hi. Nur ein Test "];
also no effect...

I played around with objects of the type NSAttributedString, creating, trying to use the inherited methods of NSTextStorage from NSAttributedString to insert the NSAttributedString into the TextStorage - does not work.

At the moment, I tried something very simple:
 NSTextStorage* store = [registers textStorage];
I inspected it in the debugger and it says "0x0" for the value... well seems wrong to me!
Next line:
 NSString* blubb2 = [store string];
This should then return the current content of the textbox as far as I know, actually the variable contains value:"0x0";Summary:"nil"... well, seems incorrect to me too (comprehensible at least - a message to a 0x0 object can not return any appropriate value~).

In the meantime I am really clueless what might be wrong, and I hope someone here might know what I am doing wrong or might have missed? :)


Best regards,
Uli
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Insert text into NSTextView/NSTextStorage does not work
      • From: John Stiles <email@hidden>
  • Prev by Date: Re: Best way to do simple binary file I/O?
  • Next by Date: bundleWithIdentifier: failures
  • Previous by thread: Re: writeToFile alternative?
  • Next by thread: Re: Insert text into NSTextView/NSTextStorage does not work
  • Index(es):
    • Date
    • Thread