Odd Selection Behavior in NSTextView
Odd Selection Behavior in NSTextView
- Subject: Odd Selection Behavior in NSTextView
- From: Josh Aas <email@hidden>
- Date: Tue, 4 Feb 2003 20:08:39 -0600
Hello all,
I am getting some weird behavior with NSTextView. I started with a
stock NSScrollView (containing an NSTextView) from IB (newest dev
tools). In my code I apply these changes (no changes to associated
layoutManager or textContainer...):
[textView setTextContainerInset:NSMakeSize(1.0,3.0)];
[textView setImportsGraphics:NO];
[textView setRichText:NO];
[textView setFont:CURRENTFONT];
My application has a checkbox that controls whether or not text should
wrap. When the user tells the app to unwrap text, these changes are
made to the textView object and its associated objects.
NSTextContainer *textContainer = [textView textContainer];
// NSScrollView changes
[scrollView setHasVerticalScroller:YES];
[scrollView setHasHorizontalScroller:YES];
[scrollView setAutoresizingMask:(NSViewWidthSizable |
NSViewHeightSizable)];
[[scrollView contentView] setAutoresizesSubviews:YES];
// NSTextContainer changes
[textContainer setContainerSize:NSMakeSize(2.0e10, 2.0e10)];
[textContainer setWidthTracksTextView:NO];
[textContainer setHeightTracksTextView:NO];
// NSTextView changes
[textView setMinSize:[scrollView contentSize]];
[textView setMaxSize:NSMakeSize(2.0e10, 2.0e10)];
[textView setHorizontallyResizable:YES];
[textView setVerticallyResizable:YES];
[textView setAutoresizingMask:NSViewNotSizable];
Everything seems to work well enough, except when I turn off wrapping
and enter a really long single line of text (~450 words averaging 4 or
5 characters each in Monaco 9 font). The text appears to appear just
fine, but when I use Apple-A to select all, not all of it is visually
selected. Somewhere around half is selected visually, but when I hit
the delete key after selecting all, it all disappears. So really, it
was all selected its just that the visual selection marker only
extended about half way. Why isn't all of the text being visually
selected?
Thanks in advance. I hope my description of the problem is clear enough!
-Josh Aas
_______________________________________________
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.