Re: Is it possible to make the height of an NSSegmentedControl taller?
Re: Is it possible to make the height of an NSSegmentedControl taller?
- Subject: Re: Is it possible to make the height of an NSSegmentedControl taller?
- From: Dave Keck <email@hidden>
- Date: Tue, 10 Mar 2009 22:35:32 -1000
On Tue, Mar 10, 2009 at 10:04 PM, Stuart Malin <email@hidden> wrote:
> I am using an NSSegmentedControl in a toolbar to hold some mutually
> exclusive selections. I invoke -setImage:forSegment: to set an image for
> each, but the images are taller than the height of the segments. I don't
> seem to have any control over that height with the NSRect I use to init the
> segmented control. I have set the segmentStyle to NSSegmentCapsuleStyle,
> which provides a bit more height. I have tried scaling the images to fit
> (using -setImageScaling:forSegment) but then the images are too small. Is it
> possible to override something somewhere to affect the cells that are used?
Try making your images smaller by using NSImage's setSize: method, or
the million other ways to scale images on OS X. Once you have an image
that's the right size, call -setImage:forSegment: with the scaled
image.
As far as resizing the NSSegmentedControl's height, there's no direct
way to do it (as far as I can see). I've never seen an
NSSegmentedControl that's a different height than stock anyway, so I
wouldn't recommend doing it simply 'cause it'll look weird :)
If you _really_ need a taller one, you could create your own custom
control. It wouldn't be too hard, but I recommend making your images
smaller to fit the stock control.
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden