PDA

View Full Version : NSButton Subclass




MacRumoron
May 6, 2006, 02:24 PM
Lets say I have two images named ButtonUp and ButtonDown..

How would I subclass NSButton so that it uses the ButtonUp image when not pressed.. and shows the ButtonDown image when pressed?

Thanks in advance if anyone can help :)



caveman_uk
May 6, 2006, 03:19 PM
Do you actually need to subclass. Can't you actually do this all in IB? I've not needed to do this buy my first guess would be use a rounded bevel button, change it's behavoir to Push On/Push Off and mess about with Icon and Alt. Icon in the inspector

Of course as I've never done this I could be totally wrong....:rolleyes:

MacRumoron
May 6, 2006, 05:08 PM
that didn't work :(

it doesn't use the alt. image when you push down

thanks anyway...

anyone else know?

mrichmon
May 6, 2006, 05:41 PM
it doesn't use the alt. image when you push down

thanks anyway...

anyone else know?

Just did it. Set one image as the Icon, the second image as the Alt Icon, set the button behavior as "toggle". Where is the problem?

MacRumoron
May 6, 2006, 06:08 PM
hmm... ok it works now..lol thanks guys

i had it set to "Momentary Push In" and it should be "Momentary Change" for it to use the alt. icon...

Thanks for the help ;)