Skip navigation.
 
mlRe: Programatically creating a checkbox
FROM : Jonathan Hess
DATE : Mon Nov 19 10:09:35 2007

Hey John -

To configure an NSButton as a checkbox, set the buttonType with -
[NSButtonCell setButtonType:] to NSSwitchButton, then set the 
bezelStyle to to NSRegularSquareBezelStyle with -[NSButtonCell 
setBezelStyle:]. You'll probably also want to set the imagePosition to 
NSImageLeft.

Good Luck -
Jon Hess

On Nov 18, 2007, at 7:34 PM, John Stiles wrote:

> How does one do it? The NSButton docs list many different types of 
> bezel, but none seem to correspond to a checkbox type. I can easily 
> create one in IB, but that doesn't give me enough info to recreate 
> it programatically. (I even tried examining it with F-Script 
> Anywhere, but that didn't reveal anything obvious either.)
>
> I know that one viable solution would be to create a checkbox in a 
> nib and then just copy it as necessary, but that seems like overkill 
> just to make one dinky little checkbox :)
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlProgramatically creating a checkbox John Stiles Nov 19, 04:34
mlRe: Programatically creating a checkbox Adam R. Maxwell Nov 19, 04:43
mlRe: Programatically creating a checkbox mmalc crawford Nov 19, 05:07
mlRe: Programatically creating a checkbox John Stiles Nov 19, 05:35
mlRe: Programatically creating a checkbox Shawn Erickson Nov 19, 05:41
mlRe: Programatically creating a checkbox Jonathan Hess Nov 19, 10:09
mlRe: Programatically creating a checkbox I. Savant Nov 19, 13:07
mlRe: Programatically creating a checkbox Alastair Houghton Nov 19, 13:40
mlRe: Programatically creating a checkbox John Stiles Nov 19, 17:01
mlRe: Programatically creating a checkbox mmalc crawford Nov 19, 17:40
mlRe: Programatically creating a checkbox John Stiles Nov 19, 18:42
mlRe: Programatically creating a checkbox mmalc crawford Nov 19, 18:53
mlRe: Programatically creating a checkbox Andy Lee Nov 19, 20:29
mlRe: Programatically creating a checkbox mmalc crawford Nov 19, 22:23
mlRe: Programatically creating a checkbox Paul Bruneau Nov 19, 22:33