title: Cocoa Mac, IB - Can an NSButton (Type Radio) be made to act like Type "Switch" while keeping bezel "Radio" in terms of clicking on/off
body: <p>This is about OSX - iOS is irrelevant to me. I have created an NSButton in InterfaceBuilder and set its bezel to "Radio". The button is not checked by default. In my application I can check it of course but when clicking it again it won't be unchecked - as radio buttons usually aren't.</p>
  
  <p>Now my question is is it possible to get the NSButton with a bezel of "Radio" which seems to fix the type to "Radio", too to act like it's type was "Switch" instead (the type "Switch" can't be selected when the bezel is "Radio" so I assume this will have to done by code). </p>
  
  <p>The question is not if this makes sense to do :-) It is if it can be done and by what means.</p>
  
  <p><b>EDIT :</b> When selecting bevel "Radio" and then setting type to "Push On Push Off" or "On Off" in Interface Builder the bezel switches to "Bevel" for the button but the radio button appearance stays nonetheless as long as one does these changes in that order and touches nothing else afterwards. The button works as on / off, too. 
  However there is one difference to the original "Radio" bezel I try to get. I am using this button in an NSBox and I can't get it not to draw the window's background color when set to type "Push On Push Off". Here is a screen shot of the problem:</p>
  
  <p><img src="https://oldendorf.net/stackoverflow/pushOnPushOff.png"></p>
  
  <p>The lower element is bevel "Radio" / type "Radio" and the upper one was switched to type "Push On Push Off" like detailed above. Can I make that window-colored square go away somehow or is there a different approach to this?</p>
  
  <p><b>EDIT 2:</b> I tried creating an IBOutlet for the according NSButtonCell and then to use:</p>
  
  <pre><code>[myButtonCell setBackgroundColor:[NSColor clearColor]];
  </code></pre>
  
  <p>The alpha coponent gets ignored however and I end up with a black background. 
  Still no idea how to solve this...</p>
  
  <p><b>Solution: </b> Odd as it might seem by chance I found that when one sets the type to "Momentary Change" one click will turn the button on and the next will turn it off and the background issue detailed above is gone. No problems.</p>
  
  <p>What the docs at <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSButtonCell_Class/Reference/Reference.html#//apple_ref/c/econst/NSPushOnPushOffButton" rel="nofollow noreferrer">https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSButtonCell_Class/Reference/Reference.html#//apple_ref/c/econst/NSPushOnPushOffButton</a> mean stating for "Momentary Change": "While the button is held down, the alternate image and alternate title are displayed. The normal image and title are displayed when the button isn’t pressed." I don't know - nothing happens when holding the button...</p>
  
  <p><b>EDIT 3: The solution above falls apart on MacOS 10.12 (Sierra) as the resulting button will never be displayed as "on" were everything worked fine until 10.11</b> </p>