Customize Slider Popupdisplay


#1

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.


#2

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.


#3

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


#4

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.


#5

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:


#6

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

Rail


#7

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 ^^