I have two NSButtons with images for both their on states and off states. Only one should be active at a time; click one and then click the other to change a property back and forth.
The problem is that if I disable a button when it's clicked so it cannot be clicked again, then the image is dimmed when the button is disabled--and I don't want it dimmed, I just want to use the alternate image. On the other hand, if I just leave the button enabled, but programmatically just don't run any code when it is clicked, then there's a flashing effect as the mouse clicks--which is distracting, when the button should not do anything.
So I either need to prevent the button from being dimmed when it is disabled, or prevent it from changing the button appearance while the mouse button is held down.
After reading up, it sounds like I need to subclass NSButtonCell and override - (BOOL)imageDimsWhenDisabled to do the former. But I can't figure out exactly how to subclass it (what sort of NSButtonCell class I should inherit from) and if the "setCell" method of NSButton is enough to use the new NSButtonCell class, or if I need to subclass NSButton as well.
Some tips on that would be appreciated, or perhaps there's a completely different approach that would achieve my objectives.
NSButtonCell
imageDimsWhenDisabled
toNO
? – Dustin