Re: Field editor drawing glitch
Re: Field editor drawing glitch
- Subject: Re: Field editor drawing glitch
- From: Robert Spychala <email@hidden>
- Date: Sun, 1 Jan 2006 21:54:24 -0500
Thanks! That fixed it.
r.S.
On Dec 30, 2005, at 9:46 AM, Glen Simmons wrote:
I ended up working around it by manually refreshing the "garbage"
rect. When I insert the field editor, I register for the
NSViewFrameDidChangeNotification notification for the field editor.
Then, the handler for that notification looks like this:
- (void)fieldEditorFrameChanged:(NSNotification *)inNote
{
NSRect newFrame = [m_pFieldEditor frame];
if (newFrame.size.height < m_FieldEditorFrame.size.height)
{
NSRect dirtyRect = m_FieldEditorFrame;
dirtyRect.origin.y = NSMaxY(newFrame);
dirtyRect.size.height -= newFrame.size.height;
[self setNeedsDisplayInRect:dirtyRect];
}
if (newFrame.size.width < m_FieldEditorFrame.size.width)
{
NSRect dirtyRect = m_FieldEditorFrame;
dirtyRect.origin.x = NSMaxX(newFrame);
dirtyRect.size.width -= newFrame.size.width;
[self setNeedsDisplayInRect:dirtyRect];
}
m_FieldEditorFrame = newFrame;
}
HTH,
Glen
On Dec 29, 2005, at 9:48 PM, Robert Spychala wrote:
Hi Glen,
Were you able to solve this problem. I experiencing the same issue.
thanks,
r.S.
On Aug 25, 2005, at 5:41 PM, Glen Simmons wrote:
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:
40visiscience.com
This email sent to email@hidden
Robert Spychala
Voice: 1-718-218-8929
Email: email@hidden
Fax: 1-919-493-3299
Robert Spychala
Voice: 1-718-218-8929
Email: email@hidden
Fax: 1-919-493-3299
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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