diff --git a/src/juce_appframework/gui/components/controls/juce_Slider.cpp b/src/juce_appframework/gui/components/controls/juce_Slider.cpp index d10a732fc6..39ed12a645 100644 --- a/src/juce_appframework/gui/components/controls/juce_Slider.cpp +++ b/src/juce_appframework/gui/components/controls/juce_Slider.cpp @@ -288,6 +288,14 @@ void Slider::setTextBoxIsEditable (const bool shouldBeEditable) throw() valueBox->setEditable (shouldBeEditable && isEnabled()); } +void Slider::showTextBox() +{ + jassert (editableText); // this should probably be avoided in read-only sliders. + + if (valueBox != 0) + valueBox->showEditor(); +} + void Slider::hideTextBox (const bool discardCurrentEditorContents) { if (valueBox != 0) diff --git a/src/juce_appframework/gui/components/controls/juce_Slider.h b/src/juce_appframework/gui/components/controls/juce_Slider.h index 704be9a50b..3c51ed4f62 100644 --- a/src/juce_appframework/gui/components/controls/juce_Slider.h +++ b/src/juce_appframework/gui/components/controls/juce_Slider.h @@ -289,6 +289,13 @@ public: */ bool isTextBoxEditable() const throw() { return editableText; } + /** If the text-box is editable, this will give it the focus so that the user can + type directly into it. + + This is basically the effect as the user clicking on it. + */ + void showTextBox(); + /** If the text-box currently has focus and is being edited, this resets it and takes keyboard focus away from it.