Customize Slider Popupdisplay

Can you customize the display which is set by

Slider::setPopupDisplayEnabled()

? I tried to look into the documentation and source code but didn’t find anything. It doesn’t need lots of modification either, just change colors, remove the round edges and the pointy thing.

https://docs.juce.com/master/structBubbleComponent_1_1LookAndFeelMethods.html

Popup display is using BubbleComponent under the hood, so override this method in your own Look And Feel to customise its look.

2 Likes

Cool thanks yeah, that helped! Is there a way to specify the decimal places of the number being shown as well as the position?

If it’s just decimal places then you can use setNumDecimalPlacesToDisplay https://docs.juce.com/master/classSlider.html#adfdee31f5271d9084e544daaa4c59423, otherwise to customise the text you’ll need to sub-class Slider and override getTextFromValue https://docs.juce.com/master/classSlider.html#a5a1693166d0815f812202b1a3a6eb202 or use textFromValueFunction https://docs.juce.com/master/classSlider.html#adb57f6910241e21118926bfe87a1fa31

Don’t think specifying the position is provided ootb, I needed to add that myself as I wanted some very specific behaviour.

1 Like

Ok thanks once more!. I’m now forcing the position on every mouseDown() as well as every mouseDrag(), which kinda feels like I’m fighting JUCE, but whatever, behaviour is as intendet :slight_smile:

https://docs.juce.com/master/classLookAndFeel__V2.html#af9dbd7c1125462a1d3c8ea548f3f7fa3

Rail

2 Likes

Aaaaaaand now it’s perfect thanks! :smiley: Took me a while to realize I have to overwrite the getter instead of calling a setter though ^^