Fix layout of wxSlider labels after changing value range.

Size of labels with new values can be different then size of current labels
and hence they should be re-laid out every time when the range is changed.

Closes #17093.
This commit is contained in:
Artur Wieczorek 2015-08-04 22:51:33 +02:00 committed by Vadim Zeitlin
parent a8c98a1191
commit 0b821adf90

View File

@ -620,6 +620,14 @@ void wxSlider::SetRange(int minValue, int maxValue)
if ( m_labels )
{
Move(wxDefaultPosition); // Force a re-layout the labels.
// Update the label with the value adjusted by the control as
// old value can be out of the new range.
if ( HasFlag(wxSL_VALUE_LABEL) )
{
SetValue(GetValue());
}
::SetWindowText((*m_labels)[SliderLabel_Min],
Format(ValueInvertOrNot(m_rangeMin)).t_str());
::SetWindowText((*m_labels)[SliderLabel_Max],