• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
cellSize bug? missing feature?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cellSize bug? missing feature?


  • Subject: cellSize bug? missing feature?
  • From: Ryan Stevens <email@hidden>
  • Date: Tue, 17 Sep 2002 11:05:56 -0700

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.

  • Follow-Ups:
    • Re: cellSize bug? missing feature?
      • From: Ryan Stevens <email@hidden>
  • Prev by Date: Re: DB-Engine
  • Next by Date: Re: DB-Engine
  • Previous by thread: Re: Menus of any other app...
  • Next by thread: Re: cellSize bug? missing feature?
  • Index(es):
    • Date
    • Thread