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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com