Text box for two value slider


It’s a very good feature to have a text entry box for slider. But this box does not work with two valued slider. I found you only need to override two functions to make it work:

void Slider::labelTextChanged(Label* label)
	const String text = label->getText();
	int index = text.indexOfChar(T(','));
		const String low = text.substring(0, index);
		const String high = text.substring(index+1, text.length());

const String getTextFromValue(double value)
	String text;
	text.printf(T("%.0f,%.0f"), getMinValue(), getMaxValue());
	return text;

However, the labelTextChanged in Slider is not virtual so I cannot override it. Is it possible to add this small feature? Thanks.


?? It’s already virtual - it’s part of the LabelListener interface…


But the Slider class override it with a non-virtual one. Does this work in C++?


It’s impossible to ‘unvirtualise’ a method! Any method that overrides a virtual method is by definition virtual, you don’t need to use the keyword.