1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Slider: Update docs regarding conversions between values and text

This commit is contained in:
Anthony Nicholls 2025-06-27 16:02:14 +01:00 committed by Anthony Nicholls
parent 1dab91e473
commit 52079652d0

View file

@ -622,10 +622,10 @@ public:
/** You can assign a lambda to this callback object to have it called when the slider's drag ends. */
std::function<void()> onDragEnd;
/** You can assign a lambda that will be used to convert textual values to the slider's normalised position. */
/** You can assign a lambda that will be used to convert text to a slider value. */
std::function<double (const String&)> valueFromTextFunction;
/** You can assign a lambda that will be used to convert the slider's normalised position to a textual value. */
/** You can assign a lambda that will be used to convert a slider value to text. */
std::function<String (double)> textFromValueFunction;
//==============================================================================
@ -746,25 +746,29 @@ public:
virtual void valueChanged();
//==============================================================================
/** Subclasses can override this to convert a text string to a value.
/** Returns a slider value for some given text.
Subclasses can override this to convert a text string to a value.
Alternatively assign a lambda to valueFromTextFunction.
When the user enters something into the text-entry box, this method is
called to convert it to a value.
The default implementation just tries to convert it to a double.
@see getTextFromValue
@see getTextFromValue, valueFromTextFunction, textFromValueFunction
*/
virtual double getValueFromText (const String& text);
/** Turns the slider's current value into a text string.
/** Returns a text representation for a given slider value.
Subclasses can override this to customise the formatting of the text-entry box.
Alternatively assign a lambda to textFromValueFunction.
The default implementation just turns the value into a string, using
a number of decimal places based on the range interval. If a suffix string
has been set using setTextValueSuffix(), this will be appended to the text.
@see getValueFromText
@see getValueFromText, textFromValueFunction, valueFromTextFunction
*/
virtual String getTextFromValue (double value);