Field editor drawing glitch
Field editor drawing glitch
- Subject: Field editor drawing glitch
- From: Glen Simmons <email@hidden>
- Date: Thu, 25 Aug 2005 16:41:22 -0500
I'm making use of my window's field editor to edit text which is
being drawn in a custom view. When the custom view is clicked and the
click is in a rect where some text is drawn, I do the following:
NSAttributedString* theAttrString = [self
textAttributedString];
NSRect textRect = [self textRect];
m_pFieldEditor = (NSTextView *)[[self window] fieldEditor:YES
forObject:self];
[m_pFieldEditor setDelegate:self];
[m_pFieldEditor setFrame:textRect];
[m_pFieldEditor setMinSize:textRect.size];
[m_pFieldEditor setMaxSize:NSMakeSize(textRect.size.width, 1.0e6)];
[m_pFieldEditor setTextContainerInset:NSZeroSize];
[[m_pFieldEditor textStorage] setAttributedString:theAttrString];
[m_pFieldEditor setAlignment:NSLeftTextAlignment];
[m_pFieldEditor setAllowsDocumentBackgroundColorChange:NO];
[m_pFieldEditor setBackgroundColor:[NSColor whiteColor]];
[[m_pFieldEditor textContainer] setWidthTracksTextView:NO];
[[m_pFieldEditor textContainer] setHeightTracksTextView:NO];
[m_pFieldEditor setHorizontallyResizable:NO];
[m_pFieldEditor setVerticallyResizable:YES];
// Activate the field editor.
[self addSubview:m_pFieldEditor];
[[self window] makeFirstResponder:m_pFieldEditor];
I want the field editor to grow as text is entered, hence the
setVerticallyResizable:YES above. This works fine unless text is
entered and deleted such that the field editor grows vertically and
then shrinks. In that case, garbage is left below it. How can I fix
this?
Thanks,
Glen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden