• 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 exception with line wrap and horizontal scroller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextView exception with line wrap and horizontal scroller


  • Subject: NSTextView exception with line wrap and horizontal scroller
  • From: "email@hidden" <email@hidden>
  • Date: Fri, 28 Jan 2011 21:34:08 +0000

Does NSTextView officially support line wrapping with the horizontal scroller remaining visible?
I have a placard in my scroller and don't want to remove it along with the scroller when I toggle between line wrapping and non wrapping.

If I don't hide the scroller I get the exception detailed below whenever the NSTextView is resized and line wrapping is on.

My line wrap toggle code :

// an NSTextView category
- (void)setLineWrap:(BOOL)wrap
{
	NSScrollView *textScrollView = [self enclosingScrollView];
	NSSize contentSize = [textScrollView contentSize];
	[self setMinSize:contentSize];
	NSTextContainer *textContainer = [self textContainer];
	if (wrap) {
		/*

		 we have a placard embedded in the horizontal scroller and ideally
		 we would like to keep the horizontal scroller visible
		 while wrapping is on.

		 however, an exception is generated if the horizontal scroller remains visible

		*/
		[textScrollView setHasHorizontalScroller:YES];	// causes exception
		[self setHorizontallyResizable:YES];
		[textContainer setWidthTracksTextView:YES];	// order matters here  : 1
		[textContainer setContainerSize:NSMakeSize(contentSize.width, FLT_MAX)]; // : 2
	} else {
		[textScrollView setHasHorizontalScroller:YES];
		[self setHorizontallyResizable:YES];
		[textContainer setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];
		[textContainer setWidthTracksTextView:NO];
	}


}

CheeseAndBiscuits has encountered an exception. You are advised to exit the application and restart.

NSInvalidArgumentException

The index 2147479551 is invalid

-[NSString rangeOfComposedCharacterSequenceAtIndex:] (in Foundation) + 99
_NSFastFillAllGlyphHolesForGlyphRange (in AppKit) + 465
-[NSLayoutManager characterRangeForGlyphRange:actualGlyphRange:] (in AppKit) + 97
-[NSTextView(NSPrivate) _setFrameSize:forceScroll:] (in AppKit) + 642
-[NSTextView setFrameSize:] (in AppKit) + 56
-[NSLayoutManager(NSPrivate) _resizeTextViewForTextContainer:] (in AppKit) + 970
-[NSLayoutManager(NSPrivate) _recalculateUsageForTextContainerAtIndex:] (in AppKit) + 2204
-[NSLayoutManager(NSPrivate) _validatedStoredUsageForTextContainerAtIndex:] (in AppKit) + 86
-[NSLayoutManager usedRectForTextContainer:] (in AppKit) + 108
-[NSTextView textContainerOrigin] (in AppKit) + 166
-[NSTextView hitTest:] (in AppKit) + 176
-[NSView hitTest:] (in AppKit) + 476
-[NSView _nextResponderForEvent:] (in AppKit) + 453


Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com







_______________________________________________

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

  • Prev by Date: Re: EXC_BAD_ACCESS when loading nib
  • Next by Date: Printing a View
  • Previous by thread: Re: EXC_BAD_ACCESS when loading nib
  • Next by thread: Printing a View
  • Index(es):
    • Date
    • Thread