• 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: real-time text display in NSTextView object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: real-time text display in NSTextView object


  • Subject: Re: real-time text display in NSTextView object
  • From: "Ujwal S. Sathyam" <email@hidden>
  • Date: Tue, 12 Aug 2003 08:11:32 -0700

On 2003-08-11 22:00:15 -0700 email@hidden wrote:


Message: 5
Date: Mon, 11 Aug 2003 22:39:04 -0500
Subject: real-time text display in NSTextView object
From: Zhiyong Wang <email@hidden>
To: email@hidden

I used the following codes to display messages in textView,

NSTextView *theTextView;
NSString *newText1, *newText2;

[theTextView setString:newText1];
[theTextView insertText:newText2];
....

The problem is that all the text will display at once after all of them have been inserted. Is there a way to update the textview in REAL-TIME whenever a new line is written to the textview? in other words, I hope the text displayed in the text view would update as soon as a new line is added, instead of displaying all the texts in one time.


Not really, unless you want to muck around in the internals of the text system. Can't you just pick off one line at a time from your text and insert it in the text view in a loop, i.e something like.

BOOL done = false;
int index = 0;
NSString *aLine;

while (!done)
{
aLine = [newText getOneLine startingFromIndex: index];
index += [aLine length];
if (aLine != nil)
{
[theTextView insertText: aLine];
}
else
{
done = YES;
}
}

Ujwal
_______________________________________________
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: Re: NSString intValue
  • Next by Date: Re: Puzzling CGBitmapImageCreate problem
  • Previous by thread: Re: real-time text display in NSTextView object
  • Next by thread: Query an NSFont: Serif or Sans Serif, is it extended or condensed, etc.
  • Index(es):
    • Date
    • Thread