Vertical slider in cocoa menu?

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

+4
source share
1 answer

This is what needs to be done programmatically (as far as I know). You can create a slider in the interface builder and make it vertical and have access to it and all that. You can also create NSMenuItem and NSMenu in Interface Builder, but you need to embed the slider in the menu item through code. This cannot be done in IB.

However, from there it is pretty simple:

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

Remember to connect the target / action slider engine to the one who needs to handle the moving one.

+4
source

Source: https://habr.com/ru/post/1303196/


All Articles