How to custom positioning valueBox of a Slider


#1

Hi, I just wanted to custom positioning the default label (valueBox variable) of a Slider but I did not find a simple way.
I saw that Slider is a LabelListener but it inherits as private and so i was not able to “link” an external label to it even if I create a
"custom" slider class.
Maybe I could make a custom Label that is a SliderListener and LabelListener too so it could be placed where I want and it will behave as the default label of the
Slider but I was looking for a “cleaner” solution.
Thanx!

Andrea


#2

There’s actually no particular reason why the labellistener needs to be private, so I might change that…

You could always use a pimpl pattern or some other way to attach a separate listener in your subclass, and TBH that’s a better approach than overriding the slider’s methods, because it would be less tightly coupled to the way the current slider implementation works.


#3

Ok, thank you!
… fast and clear!


#4

Could we also have that in the ComboBox ? I need to access the label, and limit the number of characters shown, so it’s better we have the LabelListener public instead of private. Or a way to obtain the Label*

thanx !


#5

It’s already public in ComboBox.


#6

ouch sure ! i’m using an older release as i cannot use the tip with the old jucer…

thanx !