Update Sliders textBox


#1

Would it be possible to add a method to the Slider class, like

Label *getTextBox();

so that we could write arbitary data to the slider display (without changing it’s value, but based on it’s value). For example, i have a slider that controls a parameter in a synthesizer, it’s an envelope amount that goes from -99 to +99 but the midi values are 0-198, so the slider show 0-198 values, but i’d like to show -99 - +99 values in the textbox, without having to subclassing the slider (i use the Jucer to design those guis it would be much simpler).

best regards oh fearless leader.


#2

I don’t think that’d work… You’d be continuously fighting against the slider, both trying to change the text to different things when the value changes. The only sensible way to do it is to override the slider’s text formatting method.


#3

that’s what i was afraid of, oh well i’ll figure something out.


#4

It turns out i don’t know how to do this. Could you tell me witch method to override, i tried to override the valueChanged method but i can’t access the valueBox variable cause it’s private, would it be possible to make it protected, so i could update it without sending a change notification ? the slider would not fight over the contents of the label.


#5

Slider::getTextFromValue() ?


#6

I thought this is a compute method that let’s you see what text would be displayed if this value was set, i didn’t understand that it actually was used for text display.

i’m sorry for beeing dumb :slight_smile: