Vertical slider in cocoa application menulet?

cocoa, interface-builder, macos, objective-c, xcode

Solution

This is the sort of thing that will have to be done programmatically (as far as I'm aware). You can create the slider in interface builder and make it vertical and have an outlet to it and all that. You can also create the `NSMenuItem` and the `NSMenu` in Interface Builder as well, but you'll have to embed the slider in the menuitem through code. That sort of thing can't be done in IB.

However, from there it's pretty straightforward:

NSSlider * slider = ...; //IBOutlet to your slider
NSMenuItem * item = ...; //IBOutlet to your menuitem
[item setView:slider];

Don't forget to hook up the target/action mechanism of the slider to whomever is supposed to handle the sliding.

Problem

I would like to add a vertical slider to my cocoa menulet application. Just like the vertical slider in the system volume menulet. How do I add this using Interface Builder? And if not with Interface Builder then how?

Original source