NSTextFieldCell vertical centering?
NSTextFieldCell vertical centering?
- Subject: NSTextFieldCell vertical centering?
- From: Matt Ridley <email@hidden>
- Date: Wed, 13 Jun 2001 19:23:37 +0100
Hi folks,
I have a 3-column NSTableView; the first column uses NSImageCells, and the
other two columns use the default NSTextFieldCells. I've set the rowHeight
of the NSTableView to 32 pixels, since I need to display 32x32 pixel icons
in my first column. That all works fine.
However, because the rowHeight is 32, the text in the second and third
columns is not vertically centered with the icon; the text shows at the top
of the 32 pixel rows (since the height of the text is much less than 32
pixels). I'd like to have the text vertically centered, both when being
displayed and when being edited.
Having read the documentation for the NSTableView class and the NSWindow
class, I believe I need to override this method in my NSTableView's
delegate:
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj
I'm unsure whether this would affect the display of the columns, or just
when they're being edited. Assuming that this is indeed the correct course
of action, I'd need to create an NSText object which was configured to allow
the vertical centering. However, having looked at the documentation for the
NSText class, I can't seem to find a way to do this. I see methods to set
the alignment of an NSText object, but they only allow horizontal centering.
Could someone tell me if what I want is actually possible, and if so provide
some hints on how I'd go about it? I hope I've explained all this clearly
enough. Thanks very much indeed for any assistance. :-)
Best,
-Matt
--
Matt Ridley
Scotland Software
<
http://www.scotlandsoftware.com/>