Re: Checkbox in NSTableView
Re: Checkbox in NSTableView
- Subject: Re: Checkbox in NSTableView
- From: Lisa Zorn <email@hidden>
- Date: Wed, 23 Jan 2002 14:31:23 -0800 (PST)
Stephane Sudre,
This did not work. Using setImagePosition:NSImageOnly removed the
checkbox widget completely (although it left the label). And the label
is left-aligned. I had already tried using the setImagePosition
message and nothing I tried produced the desired effect.
--- Stiphane_Sudre <email@hidden> wrote:
>
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];
>
Chuck,
Thanks for the advice. I made the subclass, but I only overrode
drawingRectForBounds:
- (NSRect)drawingRectForBounds:(NSRect)theRect
{
NSRect myret = theRect;
myret.size.width = 14;
myret.origin.x = theRect.origin.x + 0.5*theRect.size.width - 6;
return myret;
}
(The constants are estimated/tweaked). The end result looks good. I
hope it's ok that I didn't override drawWithFrame:inView:?
-lisa
--- "Chuck Pisula" <email@hidden> wrote:
>
Sounds like this could be considered a bug. I'm sure you can
accomplish
>
what you want by using a subclass of NSButtonCell, and overriding the
>
some appropriate methods. In fact, I was able to do this by simply
>
overriding drawWithFrame:inView:, and drawingRectForBounds:.
>
>
-c
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/