Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How does the field editor work?



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




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.