Slider and setTextBoxIsEditable(false)


If the valuebox of a slider gets disabled via setTextBoxIsEditable(false) and you disable and enable the slider the valuebox will be enabled again. This happens due to:

void Slider::enablementChanged() { if (valueBox != 0) valueBox->setEditable (isEnabled()); [...] }
The valuebox enablement is keeped in sync with the sliders. The valuebox enablement should be stored sepearately in ‘valueBoxEnabled’, like the menu enablement in ‘menuEnabled’.

In addition to this I suggest to change the following code:

void Slider::mouseDrag (const MouseEvent& e) { [...] if (style == LinearBar && e.mouseWasClicked()) return; [...] }
to this:

void Slider::mouseDrag (const MouseEvent& e) { [...] if (style == LinearBar && e.mouseWasClicked() && valueBoxEnabled) return; [...] }


Thanks for spotting that. In fact, the problem is that the code in enablementChanged() is a load of nonsense, probably written before I reworked the enablement mechanism. Enablement is inherited, so all the slider needs to do is:

void Slider::enablementChanged() { repaint(); }

Your other change could be done like this:

if (style == LinearBar && e.mouseWasClicked() && valueBox != 0 && valueBox->isEditable()) return;