I know the suggested method to change the number of decimal places shown in a slider is to use Slider::getTextFromValue(), but for a simple Slider I don’t want to subclass the Slider class and I just want a simple method to change the number of decimal places… so if possible could you please add:
Note that when the slider’s range is changed, then the number of decimals is reset to 7 (or something else if you have a range interval) in Slider::Pimpl::updateRange()
I’m having an issue with this when using LinearVertical sliders. No matter what I do, it won’t display 0 decimal places.
These are sliders with APVTS::sliderAttachments. The parameters associated with those sliders have a lambda function to remove the decimal places (String(value, 0)). Also, I tried with and without the line slider.setNumDecimalPlacesToDisplay(0); No luck.
But…everything works fine for rotary sliders.
Bug?
On a side note, it seems wrong that Slider::setTextBoxStyle(Slider::TextBoxBelow, allowEdit, width, height); combines a setting (where to place the textbox) with sizing parameters (width & height). Normally, you want to set the placement of the textbox once upon creating the slider, and leave the width & height parameters to be set in the resize() method. My 2 cents.
Try using the AudioProcessorValueTreeStateParameterAttributes::withStringFromValueFunction() option instead of using Slider::setNumDecimalPlacesToDisplay()