From 0b821adf903872b6d8b56630d2191c5b9c3362e5 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Tue, 4 Aug 2015 22:51:33 +0200 Subject: [PATCH] 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. --- src/msw/slider.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/msw/slider.cpp b/src/msw/slider.cpp index aea17963ba..2afb961fd2 100644 --- a/src/msw/slider.cpp +++ b/src/msw/slider.cpp @@ -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],