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

Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible


  • Subject: Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
  • From: Moray Taylor <email@hidden>
  • Date: Sun, 25 Apr 2004 20:08:22 +0100

I remember having a similar issue using Cocoa/Java, I think I was overshooting the text, what happens if you do the same thing but with

textView.textStorage().length() - 1


Cheers

Moray

The API says
public NSRange(int location, int length)

As I want to scroll to the last character and select no text at all I assume calling
scrollRangeToVisible(new NSRange(textView.textStorage().length(), 0))

is correct. No?

-dk

On Apr 25, 2004, at 8:43 PM, James Spencer wrote:


On Apr 25, 2004, at 1:13 PM, David Kocher wrote:

Hi cocoa devs,
I experience random crashes with the following code snippet

public void log(String message) {
this.textView.textStorage().replaceCharactersInRange(new NSRange(textView.textStorage().length(), 0), message + "\n"); // @warning very bad performance
this.textView.setFont(NSFont.userFixedPitchFontOfSize(9.0f));
this.textView.scrollRangeToVisible(new NSRange(textView.textStorage().length(), 0));
}

The stack trace usually looks similar to this one

Thread 11 Crashed:
0 libobjc.A.dylib 0x908311f4 objc_msgSend + 0x14
1 com.apple.AppKit 0x92e17a20 -[NSClipView _scrollTo:animate:] + 0x138
2 com.apple.AppKit 0x92e7a4b0 -[NSClipView _scrollTo:] + 0x24
3 com.apple.AppKit 0x92e25e74 -[NSClipView viewFrameChanged:] + 0xf4
4 com.apple.Foundation 0x909f793c _nsnote_callback + 0xb0
5 com.apple.CoreFoundation 0x901aa680 __CFXNotificationPost + 0x1b4
6 com.apple.CoreFoundation 0x901af090 _CFXNotificationPostNotification + 0x340
7 com.apple.Foundation 0x909f5788 -[NSNotificationCenter postNotificationName:object:userInfo:] + 0x74
8 com.apple.AppKit 0x92dfcc88 -[NSView _postFrameChangeNotification] + 0x60
9 com.apple.AppKit 0x92e773c4 -[NSView setPostsFrameChangedNotifications:] + 0x60
10 com.apple.AppKit 0x92e31364 -[NSTextView(NSPrivate) _scrollRangeToVisible:forceCenter:] + 0x4c0
11 libAppKitJava.B.dylib 0x88661ed4 Java_com_apple_cocoa_application_NSText_scrollRangeToVisible + 0x84

Maybe I'm missing something as I don't use Java but aren't the parameters you are passing to the NSRange constructors backwards, i.e. shouldn't they be:

new NSRange(0, textView.textStorage().length())

Spence

James P. Spencer
Rochester, MN

email@hidden

"Badges?? We don't need no stinkin badges!"
_______________________________________________
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.
_______________________________________________
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.


References: 
 >Java_com_apple_cocoa_application_NSText_scrollRangeToVisible (From: David Kocher <email@hidden>)
 >Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible (From: David Kocher <email@hidden>)

  • Prev by Date: Upper limit to how large an NSString (from url) can be?
  • Next by Date: xCode 1.2
  • Previous by thread: Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
  • Next by thread: Re: Java_com_apple_cocoa_application_NSText_scrollRangeToVisible
  • Index(es):
    • Date
    • Thread