Re: cellSize bug? missing feature?
Re: cellSize bug? missing feature?
- Subject: Re: cellSize bug? missing feature?
- From: Ryan Stevens <email@hidden>
- Date: Tue, 17 Sep 2002 12:35:25 -0700
You know what, nevermind. It's not worth the effort - I'm lazy. :-)
Sorry about the extra traffic.
On Tuesday, September 17, 2002, at 11:05 AM, Ryan Stevens wrote:
Hey..
I'm trying to figure out how much room I need to display the contents
of a cell without clipping. I thought that I would get this from
-cellSize but it seems to return just the width of my icon. That would
sort of make sense (initImageCell: and all) if it weren't for the fact
that I'm specifically using an NSBrowserCell and giving it a
stringValue...
Create the cell, get the size and use it:
{
NSBrowserCell *aCell = [[NSBrowserCell alloc] initImageCell:[NSImage
imageNamed:@"SomeImage"]];
[aCell setLeaf:YES];
[aCell setStringValue:@"some string"];
cellSize = [aCell cellSize]; // for future use
// using the cell here
[aCell release];
}
Since it seemed as though I was just getting the size it would take to
draw the cell w/icon and it wasn't factoring in the text I did this:
{
// Using the font specified by the view the cell is to be in - it does
exist.
NSDictionary *attribs = [NSDictionary dictionaryWithObject:theFont
forKey:NSFontAttributeName];
NSSize tmp = [@"some string" sizeWithAttributes:attribs];
// height isn't an issue, the icon gives us enough room
// get a decent width though..
cellSize.width += tmp.width;
}
Now somehow I've run-over what I need and I have extra padding. :/
Am I missing something here?
Should I just use a text cell and give it an attributed string with my
icon in it? Would cellSize on a text cell factor in attachments? I
thought I was going about this the easy way. </pulling out hair>
TIA! :)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.