Search code examples
cocoacheckboxnsbutton

Non-Editable NSButton-CheckBox


I have an NSButton styled as a check box and I'd like to deny the user from changing the state if a certain condition is true but NSButton does not have a setEditable: method and the setEnabled: method greys out the control. Is there any way to make achieve this functionality or are there alternative ways to represent data usually represented by checkboxes?


Solution

  • To provide this functionality I attached an IBAction to the check-box that "resets" the check-box's value i.e. if the check-box is on when the user clicks on it is set to on.