Re: Checkbox in NSTableView
Re: Checkbox in NSTableView
- Subject: Re: Checkbox in NSTableView
- From: Stéphane Sudre <email@hidden>
- Date: Wed, 23 Jan 2002 11:40:35 +0100
On Wednesday, January 23, 2002, at 02:07 AM, Lisa Zorn wrote:
Hello,
There have been some posts on this topic already which are pretty
useful, but I still have one remaining problem. I have an NSTableView
with checkboxes in one of the columns but I cannot get the checkboxes
to be centered. This seems like it should be trivial but as far as I
can tell, the NSButtonCell sizes itself to be the width of the column,
and does so by sizing the button title area to take up all the
remaining space. This is my guess for why the checkbox always appears
aligned with the column's left-hand edge. System preferences' Network
panel centers them; how can I?
You can by setting the NSButton to only display the image.
If you're displaying Text and Image, it's quite normal that the image is
left-aligned.
tPrototypeCell = [[[NSButtonCell alloc] initTextCell: @""] autorelease];
[tPrototypeCell setEditable: YES];
[tPrototypeCell setButtonType:NSSwitchButton];
[tPrototypeCell setImagePosition:NSImageOnly]; // HERE
[tPrototypeCell setControlSize:NSSmallControlSize];