• 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
NSTextView problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView problem


  • Subject: NSTextView problem
  • From: Peter <email@hidden>
  • Date: Sat, 4 Mar 2006 10:25:40 +0800

I am doing a simple log window of messages similar to terminal application. Messages are display row by row on a NSTextView and when it reach to bottom of the window, it should scroll up, make way for the newer incoming messages.

However after running for a while, after displaying thousands of line, it stops and the infamous spinning cursor cames out. The whole application freeze and I can only force quit. I manage to trace down the culprit, "scrollRangeToVisible" NSText method. When the statement is commented/remark then recompile for testing, the problem disappears. By commenting out the statement, however the NSTextView stops scrolling upwards when messages hit bottom of the view.

I been thinking doing a custom NSView to replace NSTextView but it looks like a lot of work and may not able to do some of the things NSTextView do (such as text selection, clipboard copy).

I hope somebody can help me with this.

Is the way around this problem ?  Why does it crash it the first place ?


// logText is the NSTextView // - (void) addStringToLog:(NSString *) msg { NSRange endOfText;

  endOfText.location = [[logText string] length];
  endOfText.length = 0;
  [logText replaceCharactersInRange: endOfText withString: msg];
  [logText scrollRangeToVisible: endOfText]; // "culprit"
}


Thanks.

Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTextView problem
      • From: Greg Herlihy <email@hidden>
  • Prev by Date: Printing two different parts
  • Next by Date: Re: unreliability of NSWorkspace selectFile
  • Previous by thread: Printing two different parts
  • Next by thread: Re: NSTextView problem
  • Index(es):
    • Date
    • Thread