NSCell Subclass used in NSTableView, what size does the cell have ( must be availaable to the cell )
NSCell Subclass used in NSTableView, what size does the cell have ( must be availaable to the cell )
- Subject: NSCell Subclass used in NSTableView, what size does the cell have ( must be availaable to the cell )
- From: devmaillists <email@hidden>
- Date: Fri, 16 Dec 2005 15:15:25 +0100
Dear List,
I use a subclassed NSTextFieldCell in a NS TableView.
in setStringValue I think I should limit the the drawing area of the
NSTextStorage.
To do this I need to know the Size of my cell.
The height is not a problem because it is the same for all cells:
test.height=[((NSTableView*)[self controlView])rowHeight];
But the collumn I am in is the question.
Or ist the a single function in the NSCell Class that returns the
correct frame.
Thank you very much…
- (void) setStringValue:(NSString *)Str
{
NSTextStorage*textStorage = [[NSTextStorage alloc] initWithString:Str];
NSTableColumn* anyColumn=[[[self controlView] tableColumns]
objectAtIndex:0];
NSSize test;
test.height=[((NSTableView*)[self controlView])rowHeight];
test.width=[anyColumn width];
NSLayoutManager* layoutManager = [[NSLayoutManager alloc] init];
NSTextContainer* textContainer = [[NSTextContainer alloc]
initWithContainerSize:test];
[layoutManager addTextContainer:textContainer];
[textContainer release];
[textStorage addLayoutManager:layoutManager];
[layoutManager release];
[super setRepresentedObject:textStorage];
}
_______________________________________________
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