How does the field editor work?
How does the field editor work?
- Subject: How does the field editor work?
- From: Drew McCormack <email@hidden>
- Date: Wed, 31 Oct 2001 20:41:28 -0800
Can anyone clarify for me exactly what goes on when the field editor is
used, and the roles played by the various classes involved?
I am trying to subclass an NSTableView. All goes well with rows resizing
etc, except for the field editor. It seems to be clipped to the size it
is when first initiated. I have tried various ways of getting it to
resize to fit all inserted text, but to no avail. The problem is, I
don't really know which object to address. Ie. Do I address
1) The NSTextView object
2) The NSLayoutManager, or
3) The NSTextContainer?
These three classes seem to interact in quite a complex way, and I can't
figure out what I should be setting to allow the fieldEditor rect to
resize and accommodate new text when edited.
One configuration I have tried is this, which is in the NSTextFieldCell
subclass I am using:
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj {
NSTextContainer *container = [textObj textContainer];
textObj = [super setUpFieldEditorAttributes:textObj];
[textObj setFieldEditor:NO];
[textObj setVerticallyResizable:YES];
[container setHeightTracksTextView:NO];
[container setWidthTracksTextView:NO];
[container setContainerSize:NSMakeSize([container
containerSize].width, 10000000.0)];
return textObj;
}
I have also tried many other variations. Can anyone tell me the correct
mix of settings?
Drew McCormack