Re: Tall NSTableView Column Headers
Re: Tall NSTableView Column Headers
- Subject: Re: Tall NSTableView Column Headers
- From: Keith Renz <email@hidden>
- Date: Fri, 22 Oct 2004 15:51:04 -0400
Can you draw the cell into an image and then scale that to fit? If
that works you'd probably want to use a second cell to layout your
text but...maybe?
Sure, you could do that, but scaling an image will distort the image.
If you look at an NSTableView's header closely, you'll see that it's
a shaded drawing which may not produce a nice scaled image. I could
scale a full height image horizontally only or use a color pattern,
but ideally, the solution should be applicable to a variable height
header like a gradient fill. On top of that, there's various states
of the header cell which would require multiple images, color
patterns or whatever; selected/not selected column + mouse down on
both -- basically 4 images. Then you've got to draw the sort
indicator on top of that, up or down.
It's all doable, but one would think that by subclassing
NSTableHeaderView and setting the view's frame height with
initWithFrame: as appropriate, you'd get the standard look, only
taller -- nope. Maybe that's why there isn't a setHeight: method. :)
I originally suggested subclassing and overriding -headerRectOfColumn:
because that's what you'd expect would work (if just giving it a
larger frame didn't).
That was a good suggestion which is why I jumped right on it! Darn, if
it only worked.
For all the wonders of Cocoa/AppKit that's got to be one of the more
annoying aspects...sometimes things just can't be done
True. It looks like I'll have to roll my own tall table headers. Not
the end of the world, though. Unfortunately, it's a hot item in the
project I'm working on and I need to get it done and move on.
(drag highlight in NSTableView..ugh!)
?? Is there an issue here?
the logical path isn't necessarily the right one or it's just more
trouble than it's worth to work around something.
We've been working with Cocoa for about 4 years now and generally it's
very usable as long as you don't stray too far. This is my first
exercise in getting down-and-dirty with NSCell which I was hoping to
avoid.
And you're right about scaling, that was just my last-ditch effort to
help.
I'm probably going to have the header cell draw an axial gradient fill
similar to the standard cell, then draw the title and sort indicator on
top of that, all in 4 different color highlights. Whoopee! This will be
a general solution for any header height; 1 text line, 2 text lines, 3
text lines, a graphic, etc.
Apple... Why didn't you do this? :)
Keith
_______________________________________________
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